0

I'm trying to set up a Windows (servercore) Docker Container where I want to install different tools like GiT, MsBuild, and so on. I wanted to install the **chocolatey ** package to make the job easier, but I found out that I cannot install anything because I do not have access to the internet.

I set up the proxy using *netsh winhttp set proxy myproxy but it's still not working to Download and Install the chocolatey package.

When I tried to install it locally (not in the container) I found out that if the Manual proxy setup (Setting -> Proxy) was not configured I would receive the same error as in the container.

So my question is: How can I set the Manual proxy setup in a Docker Container, using only powershell/cmd?

DockerFile The DockerFile that I build, where: java and agent are unimportant and the ChocoInstall.ps1 is the script that should download and install the chocolatey package.

Error while running the script This is the error I've received every time I tried to Download or Install anything that require access to the internet while building the above DockerFile.

Also, I tried the download commands from the container itself via powershell/cmd => same error as above and I also figured out that the chocolatey exists in docker hub (https://hub.docker.com/r/chocolatey/choco). But FROM https://hub.docker.com/r/chocolatey/choco command works only from Windows, not a Server Windows, where I'd get this error while trying to build it: Different operating system from Windows Server

Some commands I've also used are:

  • RUN powershell Set-ExecutionPolicy Bypass -Scope Process -Force; ` iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  • RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  • RUN SET chocolateyUseWindowsCompression='false'
  • RUN powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://chocolatey.org/install.ps1'))) "

Thank you!

PS: My server belongs to a Company.

I expect to set up the proxy somehow (not only to set it from CMD because that doesn't work for my server container) and to be able to download/install packages in it.

giosan
  • 291
  • 1
  • 4
  • 15
Cristi
  • 1
  • 2

0 Answers0