Commandes Linux : docker-compose events

DOCKER-COMPOSE EVENTS

Commande : docker-compose events
Receive real time events from containers.

Usage: events [options] [SERVICE...]

Options:
    --json      Output events as a stream of json objects

 

Recevoir les évènements en temps réels des containers :

Les évènements reçus sont du type : attach, detach, kill, pause, unpause, start, stop, top, etc.
Pour la liste complète des évènements reçus : Docker Docs – docker events

docker-compose events [--json] [SERVICE...]

ex :

$ docker-compose events
2018-10-20 23:09:26.748261 container exec_create: apk update 04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b (image=example-voting-app_result, name=example-voting-app_result_1)
2018-10-20 23:09:26.751897 container exec_start: apk update 04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b (image=example-voting-app_result, name=example-voting-app_result_1)
2018-10-20 23:09:27.886204 container exec_die 04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b (image=example-voting-app_result, name=example-voting-app_result_1)
$ docker-compose events --json
{"time": "2018-10-20T23:21:17.056049", "type": "container", "action": "exec_create: apk update", "id": "04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b", "service": "result", "attributes": {"name": "example-voting-app_result_1", "image": "example-voting-app_result"}}
{"time": "2018-10-20T23:21:17.061523", "type": "container", "action": "exec_start: apk update", "id": "04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b", "service": "result", "attributes": {"name": "example-voting-app_result_1", "image": "example-voting-app_result"}}
{"time": "2018-10-20T23:21:17.863245", "type": "container", "action": "exec_die", "id": "04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b", "service": "result", "attributes": {"name": "example-voting-app_result_1", "image": "example-voting-app_result"}}
$ docker-compose events --json | jq
{
  "time": "2018-10-20T23:23:08.660013",
  "type": "container",
  "action": "exec_create: apk update",
  "id": "04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b",
  "service": "result",
  "attributes": {
    "name": "example-voting-app_result_1",
    "image": "example-voting-app_result"
  }
}
{
  "time": "2018-10-20T23:23:08.666409",
  "type": "container",
  "action": "exec_start: apk update",
  "id": "04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b",
  "service": "result",
  "attributes": {
    "name": "example-voting-app_result_1",
    "image": "example-voting-app_result"
  }
}
{
  "time": "2018-10-20T23:23:09.460027",
  "type": "container",
  "action": "exec_die",
  "id": "04039d38798034c313f5465a3fd235252ae26f9476e269400d98827f13af857b",
  "service": "result",
  "attributes": {
    "name": "example-voting-app_result_1",
    "image": "example-voting-app_result"
  }
}

 

Fermer le menu