DOCKER SERVICE LOGS
Commande : docker service logs
Usage: docker service logs [OPTIONS] SERVICE|TASK Fetch the logs of a service or task Options: --details Show extra details provided to logs -f, --follow Follow log output --no-resolve Do not map IDs to Names in output --no-task-ids Do not include task IDs in output --no-trunc Do not truncate output --raw Do not neatly format logs --since string Show logs since timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes) --tail string Number of lines to show from the end of the logs (default "all") -t, --timestamps Show timestamps
Afficher les logs relatifs à un service ou une tâche
docker service logs [OPTIONS] service|task
ex :
Ci-dessous nous créons un service constitué de 6 tâches réparties sur 4 nodes.
$ docker service logs vote vote.3.m6vav0b3geqf@node1 | [2018-10-29 01:37:21 +0000] [1] [INFO] Starting gunicorn 19.6.0 vote.5.j88qt3ovckgp@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Starting gunicorn 19.6.0 vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Starting gunicorn 19.6.0 vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1) vote.3.m6vav0b3geqf@node1 | [2018-10-29 01:37:21 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1) vote.5.j88qt3ovckgp@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1) vote.5.j88qt3ovckgp@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Using worker: sync vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Using worker: sync [...] $ docker service logs ogafxdmgkmsn vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Starting gunicorn 19.6.0 vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1) vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [1] [INFO] Using worker: sync vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [11] [INFO] Booting worker with pid: 11 vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [12] [INFO] Booting worker with pid: 12 vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [13] [INFO] Booting worker with pid: 13 vote.1.ogafxdmgkmsn@node1 | [2018-10-29 01:37:22 +0000] [14] [INFO] Booting worker with pid: 14
Afficher les logs en mode follow (-f)
docker service logs [OPTIONS] -f service|task