...

/

Other Common Tasks

Other Common Tasks

Learn about things that we do frequently as part of our day-to-day development.

Viewing the container logs

We have seen that without the -d option, the docker-compose up attaches to the containers it starts and follows their output. However, there is also a dedicated command for viewing the container output that is more flexible. To view the container logs, we use:

$ docker-compose logs -f web 

The -f flag tells the command to follow the output, that is, to stay connected and continue to append to the screen any new output to the logs. You can press Ctrl+C to terminate the logging stream.

It’s important to realize this command displays the container output logs rather than the Rails server logs, which, by ...