debasree sarkar
debasree sarkar

Reputation: 21

Issues while creating a Windows Container for Nexus repo

For business reasons I'm forced to create a Windows Container for our internal Nexus repo. This is my docker file:

FROM mcr.microsoft.com/windows/nanoserver:1909
RUN mkdir "c:\\nexus"
WORKDIR c:/nexus
RUN mkdir "sonatype-work"
RUN mkdir "nexus-3.36.0-01"
COPY nexus-3.36.0-01 "nexus-3.36.0-01"
COPY sonatype-work "sonatype-work"
RUN cd "c:\\nexus\\nexus-3.36.0-01\\bin"
EXPOSE 8081
CMD ["nexus.exe"]

I am using the Windows Nano Server image, and my build goes well, but I am getting this error:

docker: Error response from daemon: container f204eff7c7e188ee05bae2835dbeca8b9709b88979025669cf6ea64ed36d04cd 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!00007FF62928B1D7: (caller: 00007FF62923E70B) Exception(2) tid(390) 80070002 The system cannot find the file specified. CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess] Provider: 00000000-0000-0000-0000-000000000000].

This is how I run my image:

docker run -d -p 8081:8081 myself/nexus

Any idea what am I doing wrong?

Upvotes: 2

Views: 513

Answers (1)

Federico Navarrete
Federico Navarrete

Reputation: 3274

Two changes might be required. Change this line:

RUN cd "c:\\nexus\\nexus-3.36.0-01\\bin"

For this one:

WORKDIR c:/nexus/nexus-3.36.0-01/bin

This is the correct way to set the new working directory in Docker. The CD is not going to do anything.

Also, I'm not sure if Nexus would run with this line:

CMD ["nexus.exe"]

From my experience, the correct way should be this one:

CMD ["nexus.exe /run"]

More info about the second suggestion:

https://help.sonatype.com/learning/repository-manager-3/first-time-installation-and-setup/lesson-1%3A--installing-and-starting-nexus-repository-manager?preview=%2F16351968%2F16351969%2Fchange_PW.png#:~:text=Start%20NXRM%20by%20running%20the,command%3A%20nexus.exe%20%2Frun

Upvotes: 1

Related Questions