This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Thursday, January 18, 2018

Working with Docker Container - Looking at the logs of containers

Looking at the logs of containers

If the container emits logs or output on STDOUT/STDERR, then we can get them without logging into the container.

Syntax : docker logs  CONTAINER

root@Docker:~# docker logs centos
[root@6d65e303381c /]# uptime
 04:07:13 up  1:02,  0 users,  load average: 0.02, 0.01, 0.00
[root@6d65e303381c /]# hostname
[root@6d65e303381c /]# exit

Docker will look at the container's specific log file from /var/lib/docker/containers/<Container ID> and show the result.

For help with the docker logs use --help

No comments:

Post a Comment