What does the --rm flag do in the 'docker run' command?

01.5k

The --rm flag in the docker run command automatically removes the container when it exits. This is useful for running temporary containers that you don't need to keep after they have finished executing.

Here’s an example of how to use it:

docker run --rm alpine:latest echo "Hello, World!"

In this example, the container will run the command echo "Hello, World!" and will be removed immediately after it finishes executing.

0 Comments

no data
Be the first to share your comment!