Docker 容器不健康但日志中没有错误

pka*_*mol 12 docker docker-compose airflow

我正在使用官方docker-compose 文件airflow启动它。

\n

我的一些容器看起来不健康:

\n
34d8698d67e7   apache/airflow:2.0.2   "/usr/bin/dumb-init \xe2\x80\xa6"   31 minutes ago   Up 28 minutes (unhealthy)   0.0.0.0:5555->5555/tcp, :::5555->5555/tcp, 8080/tcp   airflow_flower_1\na291cf238b9f   apache/airflow:2.0.2   "/usr/bin/dumb-init \xe2\x80\xa6"   31 minutes ago   Up 29 minutes               8080/tcp                                              airflow_airflow-init_1\nfdb20e9152f3   apache/airflow:2.0.2   "/usr/bin/dumb-init \xe2\x80\xa6"   31 minutes ago   Up 29 minutes (unhealthy)   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp             airflow_airflow-webserver_1\nabf5a16aa846   apache/airflow:2.0.2   "/usr/bin/dumb-init \xe2\x80\xa6"   31 minutes ago   Up 29 minutes               8080/tcp                                              airflow_airflow-worker_1\nf6dc352f407b   apache/airflow:2.0.2   "/usr/bin/dumb-init \xe2\x80\xa6"   31 minutes ago   Up 28 minutes               8080/tcp                                              airflow_airflow-scheduler_1\n12dfc71e518f   redis:latest           "docker-entrypoint.s\xe2\x80\xa6"   31 minutes ago   Up 29 minutes (healthy)     0.0.0.0:6379->6379/tcp, :::6379->6379/tcp             airflow_redis_1\n
Run Code Online (Sandbox Code Playgroud)\n

然而,其中之一的日志似乎信息量不大。

\n
# docker logs -f fdb20e9152f3\nWARNING! You should run the image with GID (Group ID) set to 0\n         even if you use \'airflow\' user (UID=50000)\n You started the image with UID=50000 and GID=50000\n This is to make sure you can run the image with an arbitrary UID in the future.\n See more about it in the Airflow\'s docker image documentation\n     http://airflow.apache.org/docs/docker-stack/entrypoint\nBACKEND=postgresql+psycopg2\nDB_HOST=my-db-endpoint\nDB_PORT=5432\nWARNING! You should run the image with GID (Group ID) set to 0\n         even if you use \'airflow\' user (UID=50000)\n You started the image with UID=50000 and GID=50000\n This is to make sure you can run the image with an arbitrary UID in the future.\n See more about it in the Airflow\'s docker image documentation\n     http://airflow.apache.org/docs/docker-stack/entrypoint\nBACKEND=postgresql+psycopg2\nDB_HOST=my-db-endpoint\nDB_PORT=5432\n\n
Run Code Online (Sandbox Code Playgroud)\n

无论有任何airflow具体问题,我如何检查docker发生了什么?

\n

Docker 似乎意识到一些容器不健康。

\n

编辑:两个失败的容器都有这个healtcheck条件

\n
healthcheck:\n      test: ["CMD", "curl", "--fail", "http://localhost:5555/"]\n
Run Code Online (Sandbox Code Playgroud)\n

\n
healthcheck:\n      test: ["CMD", "curl", "--fail", "http://localhost:8080/"]\n
Run Code Online (Sandbox Code Playgroud)\n

inspect通过查看他们的输出似乎失败了

\n
 Failed to connect to localhost port 8080: Connection refused\n
Run Code Online (Sandbox Code Playgroud)\n

但我无法查明导致失败的原因。

\n

编辑init:我也尝试按照说明首先启动服务

\n
# docker-compose up airflow-init\nStarting airflow_redis_1 ... done\nStarting airflow_airflow-init_1 ... done\nAttaching to airflow_airflow-init_1\nairflow-init_1       | BACKEND=postgresql+psycopg2\nairflow-init_1       | DB_HOST=my-db-endpoint\nairflow-init_1       | DB_PORT=5432\n
Run Code Online (Sandbox Code Playgroud)\n

但它永远不会退出,它会打印上面的消息,就是这样......

\n

小智 2

我遇到了类似的问题,是 docker 卷导致了问题。由于我在 Mac 上运行大量容器,因此磁盘空间不足。我设法通过修剪 docker 卷解决了这个问题。

docker 卷修剪

这将删除 mac book 上所有未使用的卷。在运行此命令之前,请检查您是否获得了任何有用的数据。