【Docker】如果重启xxxx后仍然无法启动容器
简述
由于使用docker compose up -d启动的容器无法从”Restarting”状态中恢复,因此总结了一些解决方法。
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bb79284b1635 hasura/graphql-engine:v2.9.0 "graphql-engine serve" About a minute ago Restarting (1) Less than a second ago hasura-postgress-graphql-engine-1
17e57dc1b6c4 postgres:12 "docker-entrypoint.s…" About a minute ago Restarting (1) 2 seconds ago hasura-postgress-postgres-1
应对措施 duì cuò shī
# Volumeごと消し去る
docker compose down -v
# 再度起動する
docker compose up -d
# 正常に起動できる
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8255c7a4297f hasura/graphql-engine:v2.9.0 "graphql-engine serve" 4 seconds ago Up 2 seconds 0.0.0.0:8080->8080/tcp hasura-postgress-graphql-engine-1
1578783e7786 postgres:12 "docker-entrypoint.s…" 4 seconds ago Up 3 seconds 5432/tcp hasura-postgress-postgres-1