Im trying to install Chocolatey into a docker windows container, on a Windows 10 Machine using a Windows Container and not linux containers. Im running the docker build command in the PowerShell console and every time it get to trying to install Chocolatey using the line: 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'))
It comes back with:
Exception calling "DownloadString" with "1" argument(s): "The remote name could not be resolved: 'chocolatey.org'"
At line:1 char:166
+ ... -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('ht ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
It cant seem to resolve the chocolatey.org part and I'm specifying the network card in my build command:
docker build --network 21fb9a254e4b --progress=plain --tag jcontent/dockerwinbaseimage .
I have also specified the DNS settings in the Daemon file to look at 8.8.8.8 this is in testing it was not working before this....
I have attached my Build Script. Any Help would be appreciated.
# escape=`
FROM microsoft/dotnet-framework:4.7.2-sdk-windowsservercore-ltsc2016
FROM microsoft/windowsservercore:10.0.14393.1358
RUN @powershell [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
ENV chocolateyUseWindowsCompression=false
RUN @powershell 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'))
RUN choco config set cachelocation C:\chococache
RUN choco feature enable --name allowGlobalConfirmation
RUN choco install git;
RUN choco install nodejs;
RUN choco install curl;
RUN choco install docker;
RUN choco install terraform;
# choco install visualstudio2015community --confirm --timeout 216000 \
RUN choco install dotnet4.6.1 --confirm --limit-output;
RUN choco install visualstudio2017enterprise --package-parameters "--passive --locale en-US --includeOptional" --confirm --limit-output --timeout 216000;
RUN choco install visualstudio2017-workload-azure --confirm --limit-output --timeout 21600 --package-parameters "--includeOptional";
RUN choco install visualstudio2017-workload-netcoretools --confirm --limit-output --timeout 21600 --package-parameters "--includeOptional";
RUN choco install visualstudio2017-workload-netweb --confirm --limit-output --timeout 21600 --package-parameters "--includeOptional";
# Destroy Choclotatey cache
RUN rmdir /S /Q C:\chococache
# common node tools
RUN npm install gulp -g && npm install grunt -g && npm install -g less && npm install phantomjs-prebuilt -g;
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Install .NET Core
ENV DOTNET_VERSION 3.1.7
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/release/1.1.0/Binaries/$DOTNET_VERSION/dotnet-win-x64.$DOTNET_VERSION.zip
RUN Invoke-WebRequest $Env:DOTNET_DOWNLOAD_URL -OutFile dotnet.zip; \
RUN Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet -Force; \
RUN Remove-Item -Force dotnet.zip
# Install .NET Core
ENV DOTNET_VERSION 3.1.7
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/$DOTNET_VERSION/dotnet-win-x64.$DOTNET_VERSION.zip
RUN Invoke-WebRequest $Env:DOTNET_DOWNLOAD_URL -OutFile dotnet.zip; \
RUN Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet -Force; \
RUN Remove-Item -Force dotnet.zip
# Install .NET Core SDK
ENV DOTNET_VERSION 3.1.7
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-dev-win-x64.$DOTNET_SDK_VERSION.zip
RUN Invoke-WebRequest $Env:DOTNET_SDK_DOWNLOAD_URL -OutFile dotnet.zip; \
RUN Expand-Archive dotnet.zip -DestinationPath $Env:ProgramFiles\dotnet -Force; \
RUN Remove-Item -Force dotnet.zip
SHELL ["cmd", "/S", "/C"]
RUN setx /M PATH "%PATH%;%ProgramFiles%\dotnet"
# Trigger the population of the local package cache
ENV NUGET_XMLDOC_MODE skip
RUN mkdir C:\warmup \
RUN cd C:\warmup \
RUN dotnet new \
RUN cd .. \
RUN rmdir /S /Q C:\warmup
#Change Working Directory to Install DevOps Tools
WORKDIR /azp
#Install DevOps Agents
COPY start.ps1 .
#Configure DevOps Agent
CMD powershell .\start.ps1