Docker Logs


Docker does not write logs by default. Everything you can read in the logs is contained in the container’s system log. This is sufficient for most changes. It is recommended to provoke the error to be made visible just before you work through the steps.

Find container ID

  1. start a terminal and log in if necessary
  2. Find out what name and ID the Docker has. Display container ID and name
sudo docker ps

The terminal should now display the following output

container overview

The information will be different from the one in the example. You can use the name or the ID of the container to start the log. In the example the name was used

Start log with container name

docker logs -f docker_relution

The -f option ensures that the log is always displayed continuously. Therefore, a lot of text is displayed quickly in the terminal. You can stop the log with CTRL + C and scroll up.

Save log to file

To save the logs to a file in the current path, use this command

docker logs -f docker_relution > my_logfile.txt

It is also possible to use an alternate path

docker logs -f docker_relution > /opt/relution/my_logfile.txt

If you want to transfer the file to your PC, use Filezilla, WinSCP or another SCP client