dockerdocker-composedocker-logs

docker-compose up dumps several days' worth of logs to stdout


I have an EC2 instance running a dockerized application using docker-compose.

Every time I run docker-compose up, many days' worth of logs to stdout for all services. This means that I have to wait up to an hour before all the logs have been printed and I start seeing recent logs.

Any ideas?


Solution

  • Your problem is that the old containers created by docker-compose are re-used. Starting with docker-compose up --force-recreate should do the trick.

    Though I remember this from the past, and for me, this problem no longer happens. So it could also be something else.

    Please make sure the following:

    1. You are using a modern version of docker-compose (I am running 1.29, run docker-compose version)
    2. Please make sure the containers you are starting to are not already running (docker-compose ps), as then you will attach to them instead of starting them and then printing all the logs in the container is common.