How To Delete a Docker Container At Exit

In this blog post, we will learn how to delete a Docker container after exiting the container.

RM

The Docker CLI has a switch the allows us to simply delete the container after exit.

Below, you can see an example.

I am using the –rm command switch to spin a centos container that will be deleted at exit.

docker container run --rm -it centos /bin/sh
Published
Categorized as Docker

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.