Docker delete container after running

When you run a docker image, it create a container and run it. After docker container stop, container stays, so you can use it again if required.

Some times, you need to delete docker container after it is run. This is useful if your docker container is just a command line executable. In my case, docker container have ffmpeg in it, i don’t want container left over after i executed ffmpeg command.

To auto delete container after execution, use –rm option.

Advertisement

docker run --rm DOCKER_IMAGE

Example

docker run --rm --name ffmpeg jrottenberg/ffmpeg:3.2-ubuntu -format

Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement