Docker
# Stop a single container docker stop # Delete a single container docker rm
Docker Compose
# Stop all containers defined in docker-compose.yml docker-compose down # Delete all containers defined in docker-compose.yml docker-compose down -v
Docker
docker stop
命令 | 描述 |
---|---|
docker stop |
Stops a running container |
docker rm |
Deletes a stopped container |
Docker Compose
Command | Description |
---|---|
docker-compose down |
Stops and deletes all containers defined indocker-compose.yml |
docker-compose down -v |
Stops and deletes all containers and associated volumes defined indocker-compose.yml |
Yes, you can usedocker-compose down
to stop and delete all containers defined indocker-compose.yml
simultaneously. To also remove the associated volumes, usedocker-compose down -v
停止正在运行的容器
docker rm
删除已停止的容器Docker Compose命令描述
docker-compose down code>停止并删除 docker-compose.yml
中定义的所有容器
docker-compose down -v
停止并删除
docker-compose.yml
中定义的所有容器和关联卷我可以使用 Docker 或 Docker Compose 来停止并删除所有容器是的,您可以使用 docker-compose down 同时停止并删除 docker-compose.yml 中定义的所有容器。要同时删除关联的卷,请使用 docker-compose down -v 。
以上是Docker / Docker-compose 停止并删除容器的详细内容。更多信息请关注PHP中文网其他相关文章!