[Fix] Docker Run unknown shorthand flag: 'r' in -rm


Error:
 % docker run -rm -it --name mydoc -p 80:8080 alpine 
unknown shorthand flag: 'r' in -rm
See 'docker run --help'.

Are you are getting the unknown shorthand flag error when you are trying to run a Docker Image to create a container using the run command?

Reason

The rm command is not a shorthand flag option, you need to provide two dashes before rm

Incorrect:
$ docker run -rm ubuntu
Correct
$ docker run --rm ubuntu

Fix

As discussed above simply make sure that the rm is prefixed with two dashes and not one.

Docker unknown shorthand flag error fix

Topics Coverage:


🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.

Follow Us: GitHub | Facebook | Twitter | Instagram