dockernano-server

Docker run nanoserver not starting


I am trying to run the nanoserver image on a windows server 2016 (ec2 instance, or Azure VM) with this command:

docker run -d --name nanoms microsoft/nanoserver:latest

edit: actually it is not just nanoserver, I get the same problem running microsoft/windowsservercore:latest.

But if I then run (docker ps -a) it then shows the status as Exited. Docker logs nanoms - only shows "c:>" (so no errors)

If I use -it instead of -d then it shows some 'stuff' and hangs until I hit ctrl-C, but it has actually started and I can 'login'!

'stuff' shown:

[2J[H[1H[37;40m[K[2H[K[3H[K[4H[K[5H[K[6H[K[7H[K[8H[K[9H[K[10H[K[11H[K[12H[K [13H[K[14H[K[15H[K[16H[K[17H[K[18H[K[19H[K[20H[K[21H[K[22H[K[23H[K[24H[K[25H[K [1;1HMicrosoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved.

edit 2: The above 'stuff' happens when I run the command in powershell. If I run the command in cmd prompt then using -it does successfully connect. BUT -d still always exits.

Is there something I am doing wrong here? Is there something special with windows server 2016 and docker that means -d does not work? Starting a container with -d is kinda fundamental I would think...

I have tried restarting the server, same result.

The nanoserver is a 10.0.14393.693 based image (.823 had some problem).

=================

To recreate the issue:

  1. Spin up either an EC2 instance or an Azure VM, OS == Windows Server 2016 - with Containers.
  2. RDP in, fire up a CMD window (or Powershell)
  3. Run the command: docker run -d microsoft/nanoserver
  4. Once that completes run the command: docker ps -a
  5. Verify, is the container active or exited?

My expectation is that is should be Active. Is my expectation wrong?


Solution

  • yes, your expectation is wrong :)

    The container needs to be running something. For example the command prompt you create when you ran with -it parameters. Explicitly specifying popwershell will probably work better for you...

    docker run --name nanoms microsoft/nanoserver:latest -it powershell