Why can docker-compose logs -f nginx read the log file display?

  docker, question

Why can you see the logs using docker-composelogs-fninx?

The log of the nginx container is written in the shared directory, local xx, corresponding to /var/log/nginx in the container, so the log files are all under local xx. What I don’t understand is why the docker-compose logs command knows that the log is here, and there is no place to tell it to display the log of this file!

So can you explain the principle? Thank you!


If you look at the Dockerfile of the nginx image, you will understand everything:https://github.com/nginxinc/d …