Saturday, September 27, 2014

Deleting a Docker container



If you are finished with a container, you can delete it using the docker rm command.

You must stop it first using the docker stop command or docker kill command.

Deleting a container
# docker rm ba1d58bfb1dc
ba1d58bfb1dc

Deleting a running container
# docker rm –f ba1d58bfb1dc

Deleting all containers
There is currently no command to delete all containers but you can combine docker ps –a and docker ps –q to delete all containers.

# docker rm $(docker ps -a -q)

ps –a list all the containers
ps -q list the ids of all containers

No comments:

Post a Comment