Docker Community Forums

Share and learn in the Docker community.

How to write to a container's docker log?

(Sean Boran) #1

Is there a way to write dockers log for a specific container, either within the container, or outside of (via API or docker command line)?

So far I have only found options to read the log (docker command line or API).

(Sam Saffron) #2

If you write to STDERR on the main process inside the container it goes to the logs

(Sean Boran) #3

That got me thinking. For my example, I created a /tmp/some.log, and then do a “tail -f /tmp/some.log &” in the startup script for the container. All data written to /tmp/some.log then appears in the docker log.