我正试图在码头学到更多的东西,但在运行命令时遇到了问题,我正在直接从互联网和youtube上复制这些命令。
在这个特殊的例子中,我已经从https://hub.docker.com/_/postgres中提取了postgres映像,它可以直接从获得,没有任何问题,但是当我尝试加载一个示例时,例如:
docker run -p 5432:5432 -d \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_DB=stripe-exmaple \
-v pgdata:/var/lib/postgresql/data \
postgres我遇到一个错误,它在终端中输出这一点:
C:\Program Files\Docker\Docker\resources\bin\docker.exe: invalid reference format.
See 'C:\Program Files\Docker\Docker\resources\bin\docker.exe run --help'.
-e : The term '-e' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:2 char:5
+ -e POSTGRES_PASSWORD=postgres \
+ ~~
+ CategoryInfo : ObjectNotFound: (-e:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-e : The term '-e' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:3 char:5
+ -e POSTGRES_USER=postgres \
+ ~~
+ CategoryInfo : ObjectNotFound: (-e:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-e : The term '-e' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:4 char:5
+ -e POSTGRES_DB=stripe-exmaple \
+ ~~
+ CategoryInfo : ObjectNotFound: (-e:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-v : The term '-v' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:5 char:5
+ -v pgdata:/var/lib/postgresql/data \
+ ~~
+ CategoryInfo : ObjectNotFound: (-v:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
postgres : The term 'postgres' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:6 char:5
+ postgres
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (postgres:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException我似乎能够运行单行映像命令,比如下面部署时没有问题的命令:
docker run --name postgres0 -e POSTGRES_PASSWORD=password -d -p 5432:5432 postgres:alpine我尝试过:-在管理模式下运行终端/powershell--我尝试在环境变量中添加C:\Program \Docker\Docker\resources\bin\bin\--从C:\Program \Docker\resources\bin**运行终端/powershell并不确定这是否会产生影响--运行,但这使我的膝盖受伤。
我猜这是一个小的windows 10用户错误,但是我完全被困在这里了,希望能从这个cul-de-sac中得到提示。
发布于 2020-06-14 17:46:47
在这里加起来,这样它就可以被关闭,如果它让你修好了。
你的窗户。字符是linux系统中将命令拆分为多行的一种方法。试着把它们拉出来,把所有的东西都放在一条线上,看看你从哪里开始。如果你想晚些时候打扫干净的话,也许这个。https://superuser.com/questions/1222009/line-break-in-windows-command-prompt
https://stackoverflow.com/questions/62375293
复制相似问题