Docker Community Forums

Share and learn in the Docker community.

Unable to retrieve logs using journald driver


(Agormley) #1

What I would like to do is have access to the container logs from the host. For example, if my app has problem, a user could easily see the problem without running docker exec commands.

Since journald is already picking up the logs inside the container, it seems that I should be able to use the journald driver to achieve this.

I’m running an image that uses Photon 1.0 GA OS.

The app is Lightwave which runs under systemd init.

Here’s the commands I’m using:

docker run -d --name lw-sts-0 --privileged --net=host --log-driver=journald -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /var/lib/vmware/config:/var/lib/vmware/config --volumes-from lw_data_container vmware/lightwave-sts

586958e8e21e7e785b46b85a6879fd18aac20ee6552cc053eae737c75e992541

Attempt to get logs:

docker logs lw-sts-0

Error response from daemon: configured logging reader does not support reading

verify that logs are being captured in the container:

docker exec lw-sts-0 journalctl | grep lightwave

Nov 02 20:37:54 photon-ga.eng.vmware.com configure-lightwave-server[76]: partner
Nov 02 20:37:54 photon-ga.eng.vmware.com configure-lightwave-server[76]: vsphere.local
Nov 02 20:37:54 photon-ga.eng.vmware.com configure-lightwave-server[76]: Administrator


(David Maze) #2

If the container is capturing the logs like that, then no amount of Docker log driver configuration will help you. docker logs and the docker run --log-driver option will capture the stdout and stderr of the single process Docker runs, but if that process itself captures its logs, it won’t really help you.

It may help to “publish” the container’s /var/log directory to the host using the docker run -v option. But…

It’s unusual to run an init system, and especially systemd, inside a container; you shouldn’t need to run normal applications --privileged or --net=host. I’m not familiar with that specific application, but you might try building a lighter-weight version of it that just directly runs it without going via an init system.


(Agormley) #3

Thanks, that makes sense. I was hoping to avoid data volumes for logging since there may be multiple containers on one host. Wouldn’t it get confusing if all the logs were going to the same directory/file on the host?

I mentioned the init/systemd because I realize that it’s not the preferred way to architect containers and could introduce additional complications.