docker不会重新启动我的容器,即使它列出了退出代码2是docker-compose ps。
Name Command State Ports
-----------------------------------------------------------------------------
app_autoheal_1 /docker-entrypoint autoheal Up (healthy)
seafile /sbin/my_init -- /scripts/ ... Exit 2 它是在docker-compose.yaml中用restart: always定义的。
version: '3.4'
services:
autoheal:
restart: always
image: willfarrell/autoheal
environment:
- AUTOHEAL_CONTAINER_LABEL=all
volumes:
- /var/run/docker.sock:/var/run/docker.sock
seafile:
image: seafileltd/seafile-mc:latest
restart: always
container_name: seafile
healthcheck:
test: ["CMD-SHELL", "test $(curl -k https://localhost/api2/ping/) = '\"pong\"'"]
interval: 30s
timeout: 20s
retries: 3
start_period: 30s在哪种情况下会发生这种情况?
发布于 2022-01-04 22:09:06
由Docker保留容器退出值2。容器应该通过exit 1正确地触发健康检查。
该命令的退出状态指示容器的健康状态。可能的价值是:
来源:https://docs.docker.com/engine/reference/builder/#healthcheck
https://serverfault.com/questions/1041687
复制相似问题