Docker运行不正常,它要求至少一个参数 [英] Docker run not working it says requires at least 1 argument
问题描述
我正在学习docker,并尝试运行现有映像.第一个命令运行正常
I'm learning docker, and trying to run the existing images. The first command is working fine
命令1:docker run --name静态站点-e AUTHOR ="Mathi1" -d -P dockersamples/static-site
但是下面的命令抛出错误
But the below command is throwing error
命令2:docker run --name mvcdotnet -e AUTHOR ="Mathi2" -d -p valkyrion/mvcdotnet
错误:
"docker run"至少需要1个参数.
"docker run" requires at least 1 argument.
请参阅"docker run --help".
See 'docker run --help'.
用法:docker run [OPTIONS] IMAGE [COMMAND] [ARG ...]
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
在新容器中运行命令
推荐答案
根据 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
…
命令1使用 -P
(-publish-all
的缩写),然后使用图像名称. -P
没有参数.命令2使用 -p
(-发布列表
的缩写). -p
需要一个参数,我认为docker将图像名称误认为是 -p
的参数(并在之后使用图像名称).
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).
这篇关于Docker运行不正常,它要求至少一个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!