Deleting Containers and Images from Docker

If you want to delete specific image or container from docker registry, it is very easy to delete just by writing following command.

for container: docker rm [container name]
for image: docker rmi [image id/name]

What about if you want to delete all the images and containers from your docker? It is very easy to remove all container and images at once as well. Please execute following command to remove all containers from docker

docker rm $(docker ps -a -q)

This command won’t delete running containers. You need to stop all the running containers if you want to delete running container as well.

On the other hand, if you want to delete all the images from docker registry, you can run following command.

docker rmi $(docker images -q)

Sometimes above command won’t delete all the images from docker. If it did not delete some images, you can run following command to force delete.

docker rmi -f $(docker images -q)

 

reference: https://github.com/docker/docker/issues/928#issuecomment-23538307

One thought on “Deleting Containers and Images from Docker

  1. When I click the top title at the Home page, rest of the title is disappeared and I was searching how to get the other title. After playing few minutes, I figure out that I have to click Home page every time. I will be convenient if you inform user through some text or anything that user has to click on Home page to get next Title.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s