Docker Compose Logs Not Showing

Viewed 3060

When I run docker-compose up, Docker will run the following four containers. They run completely successfully.

[+] Running 4/4
 ⠿ Container redis_1     Started                                                                             5.6s
 ⠿ Container postgres_1  Started                                                                             4.6s
 ⠿ Container celery_1    Started                                                                             8.2s
 ⠿ Container flask_1     Started                                                                            12.3s

However, because flask_1 depends on the other three containers, it starts that container last.

The problem with this is that initial console output from the first three containers that appears before flask_1 has started does not appear.

The output I see is

[+] Running 4/4
 ⠿ Container redis_1     Started                                                                                                              5.1s
 ⠿ Container postgres_1  Started                                                                                                              3.8s
 ⠿ Container celery_1    Started                                                                                                              7.7s
 ⠿ Container flask_1     Started                                                                                                             11.3s
Attaching to celery_1, flask_1, postgres_1, redis_1
flask_1     |  * Serving Flask app "run.py" (lazy loading)
flask_1     |  * Environment: development
flask_1     |  * Debug mode: on
flask_1     |  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
flask_1     |  * Restarting with stat
flask_1     |  * Debugger is active!
flask_1     |  * Debugger PIN: 210-689-137

But if I check the logs of one of the other containers manually, for instance postgres_1. There is plenty of output that is just not displayed.

2021-07-04 18:35:59.469 UTC [1] LOG:  starting PostgreSQL 13.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 64-bit
2021-07-04 18:35:59.469 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2021-07-04 18:35:59.469 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2021-07-04 18:35:59.471 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-07-04 18:35:59.475 UTC [22] LOG:  database system was shut down at 2021-07-04 18:35:28 UTC
2021-07-04 18:35:59.477 UTC [1] LOG:  database system is ready to accept connections

How can I get docker to show this initial output that it's skipping?

0 Answers
Related