All Docker Delete Container Command | Delete Run, Stop, Exit Container


So today we will cover docker delete container. Deleting a container is very simple. We can remove it in a single docker command. But before deleting the container. First we will find the docker container status.

Because for deleting or removing docker container. We must know each container status. So that we can use the deleting or removing command according to the container status.

Each container can have three status. Like Run, Stop and Exit.

So according to all these multiple container status. We will use the delete command.

Docker Delete Container

Delete Run Status Container

We use this command to delete the running containers.

sudo docker rm -f <container-name/ID>

Delete Multi-Run Status Container

This is used to delete the multiple running containers.

sudo docker rm -f <container-name/ID> <container-name/ID>

Delete Stop Status Container

This will delete the stopped container.

sudo docker rm -f <container-name/ID>

Delete Multi-Stop Status Container

And it is used to delete the multiple stopped containers.

sudo docker rm -f <container-name/ID> <container-name/ID>

Delete Exit Status Container

It will delete the exited container.

sudo docker rm -f  status=exit <container-name/ID>

Delete Multi-Exit Status Container

It will delete the multiple exited containers.

sudo docker rm -f  status=exit <container-name/ID> <container-name/ID>

See/List  All Container Command

When you make your mind to delete the container. Then before that first check is there any container present on your system or not.

Run Status Container

sudo docker ps

Stop Status Container

sudo docker ps -a

Exit Status Container

sudo docker ps -a -f status=exit

Because if there is no container available on your system. Then you first go and create docker container from image.

Create Docker Container

If you do not have any container available. Then you create it very easily. You can visit the link below. I described it in a very simple way.

Conclusion

So in conclusion, we have completed the topic docker delete container. We also covered how we can delete the multiple status container. We also looked before deleting the container. How we can find the available container according to their status.

So I hope this article was very helpful to you in understanding how to delete the containers.

Thank you very much for reading this.