当我运行时docker-compose up,Docker将运行以下四个容器。他们运行完全成功。
[+] Running 4/4\n \xe2\xa0\xbf Container redis_1 Started 5.6s\n \xe2\xa0\xbf Container postgres_1 Started 4.6s\n \xe2\xa0\xbf Container celery_1 Started 8.2s\n \xe2\xa0\xbf Container flask_1 Started 12.3s\nRun Code Online (Sandbox Code Playgroud)\n但是,由于flask_1依赖于其他三个容器,因此它最后启动该容器。
这样做的问题是,flask_1启动之前出现的前三个容器的初始控制台输出不会出现。
我看到的输出是
\n[+] Running 4/4\n \xe2\xa0\xbf Container redis_1 Started 5.1s\n \xe2\xa0\xbf Container postgres_1 Started 3.8s\n \xe2\xa0\xbf Container celery_1 Started 7.7s\n \xe2\xa0\xbf Container flask_1 Started 11.3s\nAttaching to celery_1, flask_1, postgres_1, redis_1\nflask_1 | * Serving Flask app "run.py" (lazy loading)\nflask_1 | * Environment: development\nflask_1 | * Debug mode: on\nflask_1 | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)\nflask_1 | * Restarting with stat\nflask_1 | * Debugger is active!\nflask_1 | * Debugger PIN: 210-689-137\nRun Code Online (Sandbox Code Playgroud)\n但是,如果我手动检查其他容器之一的日志,例如postgres_1。有大量输出只是未显示。
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\n2021-07-04 18:35:59.469 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432\n2021-07-04 18:35:59.469 UTC [1] LOG: listening on IPv6 address "::", port 5432\n2021-07-04 18:35:59.471 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"\n2021-07-04 18:35:59.475 UTC [22] LOG: database system was shut down at 2021-07-04 18:35:28 UTC\n2021-07-04 18:35:59.477 UTC [1] LOG: database system is ready to accept connections\nRun Code Online (Sandbox Code Playgroud)\n如何让 docker 显示它正在跳过的初始输出?
\n| 归档时间: |
|
| 查看次数: |
4059 次 |
| 最近记录: |