Docker Community Forums

Share and learn in the Docker community.

Issues while creating windows container nexus

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

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"
CMD ["nexus.exe"]

I am using windows nano server image and the 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.
Provider: 00000000-0000-0000-0000-000000000000].

This is how I run the image

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

Any idea what am I doing wrong here?

This line above does not make sense. You cannot change the workdir using cd. It effects only that RUN directive. Use WORKDIR directive again before CMD instead of RUN