Linux command
docker-container-rm 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Remove a container
docker container rm [container]
Remove multiple containers
docker container rm [container1] [container2]
Force remove running container
docker container rm -f [container]
Remove container and volumes
docker container rm -v [container]
Remove all stopped containers
docker container rm $(docker container ls -aq -f status=exited)
说明
docker container rm removes one or more containers from the Docker host, freeing disk space occupied by the container's read-write layer and metadata. Containers must be stopped before removal unless the -f flag is used to force removal of running containers. The -v option also removes anonymous volumes associated with the container, which is useful for complete cleanup. Named volumes are preserved by default to prevent accidental data loss. The shorthand docker rm is equivalent to docker container rm.
参数
- -f, --force
- Force the removal of a running container (uses SIGKILL).
- -v, --volumes
- Remove anonymous volumes.
- -l, --link
- Remove the specified inter-container network link rather than the container itself.
FAQ
What is the docker-container-rm command used for?
docker container rm removes one or more containers from the Docker host, freeing disk space occupied by the container's read-write layer and metadata. Containers must be stopped before removal unless the -f flag is used to force removal of running containers. The -v option also removes anonymous volumes associated with the container, which is useful for complete cleanup. Named volumes are preserved by default to prevent accidental data loss. The shorthand docker rm is equivalent to docker container rm.
How do I run a basic docker-container-rm example?
Run `docker container rm [container]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -f, --force do in docker-container-rm?
Force the removal of a running container (uses SIGKILL).