从dockerfile构建docker映像时,意外令牌'('附近的语法错误

时间:2020-08-20 02:44:27

标签: powershell docker

我正在尝试对docker文件中的高山图像运行以下命令:

我已经安装了powershell,并试图通过powershell命令获得巧克力味。

RUN pwsh -c Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

并遇到此错误

/ bin / bash:-c:第0行:意外令牌'('

附近的语法错误

我还尝试了以下内容,并遇到了同样的问题。

SHELL ["/bin/bash", "-c"] \
RUN shopt -s extglob

1 个答案:

答案 0 :(得分:0)

您缺少'

RUN pwsh -c 'Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString("https://chocolatey.org/install.ps1"))'