繁体   English   中英

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

[英]Docker container unhealthy but no error in the logs

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

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

34d8698d67e7   apache/airflow:2.0.2   "/usr/bin/dumb-init …"   31 minutes ago   Up 28 minutes (unhealthy)   0.0.0.0:5555->5555/tcp, :::5555->5555/tcp, 8080/tcp   airflow_flower_1
a291cf238b9f   apache/airflow:2.0.2   "/usr/bin/dumb-init …"   31 minutes ago   Up 29 minutes               8080/tcp                                              airflow_airflow-init_1
fdb20e9152f3   apache/airflow:2.0.2   "/usr/bin/dumb-init …"   31 minutes ago   Up 29 minutes (unhealthy)   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp             airflow_airflow-webserver_1
abf5a16aa846   apache/airflow:2.0.2   "/usr/bin/dumb-init …"   31 minutes ago   Up 29 minutes               8080/tcp                                              airflow_airflow-worker_1
f6dc352f407b   apache/airflow:2.0.2   "/usr/bin/dumb-init …"   31 minutes ago   Up 28 minutes               8080/tcp                                              airflow_airflow-scheduler_1
12dfc71e518f   redis:latest           "docker-entrypoint.s…"   31 minutes ago   Up 29 minutes (healthy)     0.0.0.0:6379->6379/tcp, :::6379->6379/tcp             airflow_redis_1

但是,例如其中之一的日志似乎信息量不大。

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

不管任何airflow - 具体问题,我如何检查docker - 明智的是发生了什么?

Docker 似乎意识到有几个容器不健康。

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

healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost:5555/"]

healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost:8080/"]

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

 Failed to connect to localhost port 8080: Connection refused

但我无法确定导致失败的原因。

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

# docker-compose up airflow-init
Starting airflow_redis_1 ... done
Starting airflow_airflow-init_1 ... done
Attaching to airflow_airflow-init_1
airflow-init_1       | BACKEND=postgresql+psycopg2
airflow-init_1       | DB_HOST=my-db-endpoint
airflow-init_1       | DB_PORT=5432

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

我遇到了类似的问题,是 docker 卷导致了这个问题。 当我在我的 Mac 上运行很多容器时,没有足够的磁盘空间。 我设法通过修剪 docker 卷解决了这个问题。

docker 卷修剪

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

对于 docker-compose,从入口点来看,组 id 的默认值为 0。

"${AIRFLOW_UID:-50000}:${AIRFLOW_GID:-0}"

在 Airflow 项目存储库中编辑 docker-compose.yaml 文件或 ad ass env.sh 文件。

由于分配给 docker 用于运行此图像的 memory 较少,这似乎是一个错误,尝试增加 docker 的可用资源并查看魔法

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM