簡體   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