user

Run containers with docker-compose and view logs

Introduction

David Fava

David Fava


LATEST POSTS

How to issue ACMEv2 Wildcard with Certbot on Ubuntu 18.04 14th July, 2018

Jenkins and SSL: x509: certificate signed by unknown authority error 30th June, 2018

Linux

Run containers with docker-compose and view logs

Posted on .

Docker compose can be run in detached mode and you can attach to the logs of all container later.

If you’re done watching logs you can detach yourself from the logs output without shutting down your services.

  1. Use docker-compose up -d to start all services in detached mode (-d) (you won’t see any logs in detached mode)
  2. Use docker-compose logs -f -t to attach yourself to the logs of all running services, whereas -f means you follow the log output and the -t option gives you nice timestamps (See Docker reference)
  3. Use Ctrl + z or Ctrl + c to detach yourself from the log output without shutting down your services

If you’re interested in a single container you can use the docker keyword instead:

  1. Use docker logs -t -f <container-name>

 

Ref: https://stackoverflow.com/questions/37195222/how-to-view-log-output-using-docker-compose-run

David Fava

David Fava

There are no comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

View Comments (0) ...
Navigation