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.
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.
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.