Linux command
docker-rm 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Remove a container
docker rm [container]
Remove multiple containers
docker rm [container1] [container2]
Force remove running container
docker rm -f [container]
Remove container and volumes
docker rm -v [container]
Remove all stopped containers
docker rm $(docker ps -aq)
说明
docker rm removes one or more containers. Containers must be stopped unless -f is used. Does not remove images; use docker rmi for that. Container removal frees up disk space and cleans up container metadata from the Docker daemon. Named volumes are preserved unless explicitly removed with -v.
参数
- -f, --force
- Force removal of running container.
- -l, --link
- Remove specified link.
- -v, --volumes
- Remove anonymous volumes attached to container.
FAQ
What is the docker-rm command used for?
docker rm removes one or more containers. Containers must be stopped unless -f is used. Does not remove images; use docker rmi for that. Container removal frees up disk space and cleans up container metadata from the Docker daemon. Named volumes are preserved unless explicitly removed with -v.
How do I run a basic docker-rm example?
Run `docker rm [container]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -f, --force do in docker-rm?
Force removal of running container.