title: Cannot start Sonatype Nexus3 service when running docker Windows image
body: <p>I'm new to docker and I'm trying to get Nexus3 running in a windows container.</p>
  
  <p>My machine is running Windows 10 and I'm using:
  Docker CE Version 17.03.1-ce-win12 (12058)
  Channel: stable
  d1db126</p>
  
  <p>I have the following DockerFile content.</p>
  
  <pre><code>FROM microsoft/nanoserver
  #FROM microsoft/windowsservercore     # I also tried this as the base image in case something was missing that I needed.
  EXPOSE 8081
  ADD /content /nexus3
  
  WORKDIR \\nexus3\\nexus-3.3.1-01-win64\\nexus-3.3.1-01\\bin
  RUN ["nexus.exe", "/install", "nexus3"]
  RUN ["nexus.exe", "/start", "nexus3"]
  RUN ["powershell", "-Command", "Get-Service", "nexus3"]
  </code></pre>
  
  <p>The content folder tree looks something like this and is just the nexus3 download for windows that is already unzipped.</p>
  
  <pre><code>B:\Docker\nexus\content
  ==&gt; tree /A
  B:.
  \---nexus-3.3.1-01-win64
      +---nexus-3.3.1-01
      |   +---.install4j
      |   +---bin
      |   +---deploy
      |   +---etc
      |   +---jre
      |   +---lib
      |   +---public
      |   \---system
      \---sonatype-work
  </code></pre>
  
  <p>When the container is build, it says that the service in installed and is started. I have confirmed this using Get-Service nexus3. Here is the build output:</p>
  
  <pre><code>B:\docker\nexus
  ==&gt; docker build -t nexus3 .
  Sending build context to Docker daemon   222 MB
  Step 1/7 : FROM microsoft/nanoserver
   ---&gt; 6c367cf4cb98
  Step 2/7 : EXPOSE 8081
   ---&gt; Running in 047d556668ac
   ---&gt; 6478e2faf841
  Removing intermediate container 047d556668ac
  Step 3/7 : ADD /content /nexus3
   ---&gt; caacf937e885
  Removing intermediate container cb601d94cd4a
  Step 4/7 : WORKDIR \\nexus3\\nexus-3.3.1-01-win64\\nexus-3.3.1-01\\bin
   ---&gt; d0e1afd3d105
  Removing intermediate container 201e369a32de
  Step 5/7 : RUN nexus.exe /install nexus3
   ---&gt; Running in 61516df89010
  Installed service 'nexus3'.
   ---&gt; bbfff0f34205
  Removing intermediate container 61516df89010
  Step 6/7 : RUN nexus.exe /start nexus3
   ---&gt; Running in ff274ef81a91
  Service is already running.
   ---&gt; ba20f07a47ce
  Removing intermediate container ff274ef81a91
  Step 7/7 : RUN powershell -Command Get-Service nexus3
   ---&gt; Running in 3c8c767a56fd
  
  Status   Name               DisplayName
  ------   ----               -----------
  Running  nexus3             nexus3
  
  
   ---&gt; ef166720c132
  Removing intermediate container 3c8c767a56fd
  Successfully built ef166720c132
  </code></pre>
  
  <p>So far so good. Now I run the image using the following command:</p>
  
  <pre><code>docker run -it nexus3 powershell
  </code></pre>
  
  <p>Now using the powershell terminal from inside the container I check to see if the service is running:</p>
  
  <pre><code>Get-Service nexus3
  Status   Name               DisplayName
  ------   ----               -----------
  Stopped  nexus3             nexus3
  </code></pre>
  
  <p>So I ran the following but it hates me! ;-)</p>
  
  <pre><code>Start-Service nexus3
  
  Start-Service : Failed to start service 'nexus3 (nexus3)'.
  At line:1 char:1
  + Start-Service nexus3
  + ~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
      + FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand
  </code></pre>
  
  <p>Now correct me if i'm wrong here but I should have an administrator powershell inside the container, because of the "docker run -it" switch, therefore this should not be a permissions problem around starting the service.</p>
  
  <p>I also checked that the service was set to run automatically and it was fine:</p>
  
  <pre><code>==&gt;$(Get-Service nexus3).StartType
  Automatic
  </code></pre>
  
  <p>Does anyone have any idea what I'm doing wrong here? The fact that the service starts on a build but fails to start when I run it suggests I'm missing something but I can't figure it out.</p>