Docker
<code># Stop a single container docker stop <container-name> # Delete a single container docker rm <container-name></code>
Docker Compose
<code># Stop all containers defined in docker-compose.yml docker-compose down # Delete all containers defined in docker-compose.yml docker-compose down -v</code>
Docker
命令 | 描述 |
---|---|
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 in docker-compose.yml
|
docker-compose down -v |
Stops and deletes all containers and associated volumes defined in docker-compose.yml
|
Yes, you can use docker-compose down
to stop and delete all containers defined in docker-compose.yml
simultaneously. To also remove the associated volumes, use docker-compose down -v
停止正在运行的容器
docker rm
🎜删除已停止的容器🎜🎜🎜Docker Compose🎜🎜🎜🎜🎜🎜命令🎜🎜描述🎜🎜🎜🎜🎜🎜docker-compose down code>🎜停止并删除 <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中文网其他相关文章!