小编mat*_*tt9的帖子

什么是"约会"?"Get-Command date"抛出CommandNotFoundException

date 工作:

PS> date

Saturday, June 10, 2017 9:10:11 AM
Run Code Online (Sandbox Code Playgroud)

Get-Command date抛出异常:

PS> Get-Command date
Get-Command : The term 'date' 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:1 char:1
+ Get-Command date
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (date:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
Run Code Online (Sandbox Code Playgroud)

Get-Alias date …

powershell

14
推荐指数
2
解决办法
418
查看次数

如何使用Dockerfile for Windows image的ARG指令

我想在我的 dockerfile 中传递一个参数来构建我的 docker 镜像。我在其他帖子和 docker 手册中看到过如何执行此操作,但在我的情况下不起作用。这是我使用参数的代码摘录:

ARG FirefoxVersion
RUN powershell -Command iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));
RUN choco install -y firefox --version $FirefoxVersion --ignore-checksums
Run Code Online (Sandbox Code Playgroud)

我在 powershellPrompt 中使用此命令构建我的图像:

docker build -t myimage --build-arg FirefoxVersion=61.0.1 .
Run Code Online (Sandbox Code Playgroud)

最后我有这个错误:

 '$FirefoxVersion' is not a valid version string.
 Parameter name: version
 The command 'cmd /S /C choco install -y firefox --version $FirefoxVersion  -- ignore-checksums' returned a non-zero code: 1
Run Code Online (Sandbox Code Playgroud)

有人知道我的代码有什么问题吗?谢谢。

docker dockerfile docker-for-windows

5
推荐指数
2
解决办法
5767
查看次数