Docker Community Forums

Share and learn in the Docker community.

How to send output of CMD / ENTRYPOINT to "log"

In the container I used to run a .sh file that launched a program with arguments like this:

program -c /etc/configfile



This resulted in output of the program going to log. Not sure what log exactly but in Portainer when clicking the container log, you could see what is going on.

Then I realized that

ENTRYPOINT ["program"]
CMD ["-c", "/etc/configfile"]

is the way to go.
But this results in no more logs.

Portainer for example says “No logs available.”
What do I have to do to still get the logs? Or even better, to make it an option via ENTRYPOINT.

I found someone linking (ln) the application log to /dev/stdout and/or /dev/stderr. Is this best practice? Same here. Assuming this is the way to go unless a better answer appears below.

You want to log to stdout. Most programs have some option to log to stdout, but it’s program specific.