如何使用Docker 或Docker Compose 停止和刪除容器?本文提供了使用 Docker 和 Docker Compose 停止和刪除容器的命令。它解釋了用於停止和刪除single 和mu
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 中使用哪些指令來停止和刪除容器?
Docker
Command | Description |
---|---|
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
|
同時停止和刪除 docker-compose down
中定義的所有容器。若要同時刪除關聯的捲,請使用 docker-compose.yml
.docker-compose down -v
以上是Docker / Docker-compose 停止並刪除容器的詳細內容。更多資訊請關注PHP中文網其他相關文章!