我正在尝试在 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 FilesDockerDockerresourcesbindocker.exe: invalid reference format.
See 'C:Program FilesDockerDockerresourcesbindocker.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
我试过: - 在管理模式下运行终端/电源外壳 - 我尝试将 C:\Program Files\Docker\Docker\resources\bin\ 添加到环境变量 - 从 C:\Program Files\Docker\Docker\resources\bin\ 运行终端/powershell *不确定这是否会有所作为 - 跑步,但这让我的膝盖受伤
我猜这是一个小的 windows 10 用户错误,但完全被困在这里,并希望从这个死胡同中得到提示
在此处添加,以便在修复您时可以关闭它。
\ 字符是一种在 Linux 系统上将命令分成多行的方法。 试着把它们拉出来,把它们全部放在一行里,看看你从哪里开始。 那么如果你想稍后清理,也许这个。 https://superuser.com/questions/1222009/line-break-in-windows-command-prompt