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.

docker run --rm DOCKER_IMAGE

Example

docker run --rm --name ffmpeg jrottenberg/ffmpeg:3.2-ubuntu -format
Need help with Linux Server or WordPress? We can help!

Leave a Reply

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