[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


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap