Reputation: 349
I've looked at a few questions, but I couldn't find anything that matched my issue. If this is a duplicate, I apologize!
Currently, I'm trying the create a Jenkins docker container using chocolatey inside a dockerfile script. My current script is the following
# escape=`
# Microsoft ISO required for building Empower
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["cmd", "/S", "/C"]
# Install Chocolatey on the docker container
RUN powershell -Command `
"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'))"
# Install Jenkins
RUN powershell -Command `
"choco install -y jenkins"
This built fine, and produced me the following image, which I've tried to add a run command to
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b18ae2b6432 724f89147e6f "-p 8080:8080" 3 minutes ago Created docker_jenkins
Unfortunately, this errors with the following, when starting the container
Error response from daemon: container 1b18ae2b64329c57953b81c1fba2c3f95836f3ae0a77affe0b00bbcd18ef1125 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF73DE39D2B: (caller: 00007FF73DDEE13A) Exception(2) tid(39c) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"-p 8080:8080","WorkingDirectory":"C:\\","CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}
Error: failed to start containers: docker_jenkins
I can't quite tell what's going wrong. Any information on the matter would be greatly appreciated. I'm quite new to docker and containers, so I apologize if this is a silly question!
Upvotes: 0
Views: 412
Reputation: 349
I managed to solve this issue. The following dockerfile is what I ended up with
# escape=`
# Microsoft ISO required for building Empower
FROM mcr.microsoft.com/windows/servercore:ltsc2019
# Update shell to powershell
SHELL ["powershell", "-command"]
# Install Chocolatey on the docker container
RUN 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'))
# Install Jenkins
RUN choco install -y jenkins
Upvotes: 1