简体   繁体   中英

How to differentiate docker system logs from docker container logs?

Everything I saw about the docker daemon logs is that they can be found under journalctl -u docker in case of systemd presence.

Recently my docker (v.1.13.1) containers hung up. sudo journalctl -u docker only gives me container logs that generated by my applications. I see no docker daemon output there. Docker logging driver is journald . I also enabled debug output in /etc/docker/daemon.json . Nothing changed.

So, how to see docker daemon system logs?

I'm using docker 17.09.0-ce, but I hope that with my suggestions you could activate them.

  1. First of all, shutdown dockerd daemon.
  2. Second, edit dockerd configuration file and activate loglevel.

In my case, docker config file is in /etc/init/docker.conf

There, you'll finde something like that:

script
        # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
        DOCKERD=/usr/bin/dockerd
        DOCKER_OPTS=
        if [ -f /etc/default/$UPSTART_JOB ]; then
                . /etc/default/$UPSTART_JOB
        fi
        exec "$DOCKERD" $DOCKER_OPTS --raw-logs
end script

Look at exec line, where is specified --raw-logs . At this line you should add --log-level debug , because default is info, as you can see in dockerd help:

dockerd --help | grep log-level
 -l, --log-level string                        Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
  1. Finally, restart docker daemon and check logs with journalctl.

    sudo /etc/init.d/docker restart

  2. Check logs as you told before.

    sudo journalctl -u docker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM