Reputation: 1429
I'm learning docker, and trying to run the existing images. The first command is working fine
command 1: docker run --name static-site -e AUTHOR="Mathi1" -d -P dockersamples/static-site
But the below command is throwing error
Command 2: docker run --name mvcdotnet -e AUTHOR="Mathi2" -d -p valkyrion/mvcdotnet
Error:
"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
Upvotes: 2
Views: 12122
Reputation: 363
According to docker help run
:
…
-p, --publish list Publish a container's port(s) to the host
-P, --publish-all Publish all exposed ports to random ports
…
Command 1 uses -P
(short form of --publish-all
) and after that the image name. -P
has no arguments.
Command 2 uses -p
(short form of --publish list
). -p
expects an argument and I think docker mistakes the image name as the argument for -p
(and expects an image name after that).
Upvotes: 1