Docker:Windows 10-环境似乎无法识别docker脚本

问题描述 投票:0回答:1

我正在尝试在Docker中学习更多信息,但在运行直接从互联网和youtube复制的命令时遇到问题。

在这个特定示例中,我从docker提取了postgres图像,该图像可以直接从https://hub.docker.com/_/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 Files \ Docker \ Docker \ resources \ bin \添加到环境变量-从C:\ Program Files \ Docker \ Docker \ resources \ bin \运行终端/ Powershell *不确定是否会有所作为-跑步,但膝盖受伤]

我猜这是Windows 10的一个小错误,但完全卡在这里,不胜感激此小提示

docker windows-10
1个回答
0
投票

在此处添加,以便在修复后将其关闭。

您在Windows上。 \字符是在Linux系统上将命令分成多行的一种方法。尝试将它们拉出,然后将它们全部放在一行中以查看着陆的起点。如果您以后要清理,也许是这样。 https://superuser.com/questions/1222009/line-break-in-windows-command-prompt

© www.soinside.com 2019 - 2024. All rights reserved.