#powershell #docker
#powershell #docker
Вопрос:
Я пытаюсь выполнить приведенную ниже команду над изображением alpine в моем файле docker:
У меня установлен powershell и я пытаюсь получить chocolatey с помощью команд 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. Заключите все после
-c
в'...'
и используйте"..."
вокруг URL.
Ответ №1:
Вы пропускаете ‘
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"))'