Docker Community Forums

Share and learn in the Docker community.

Starting Windows containers automatically on reboot (Windows 10)

My OS is Windows 10 and I am running Docker version 17.06.0-ce-win19. I am trying to set up a container so that it will restart automatically on reboot.

When I use the command: docker run -it microsoft/nanoserver --restart=always

I’m getting the following error:

docker: Error response from daemon: container 35046c88d2564523464ecabc4d48eb0550115e33acb25b0555224e7c43d21e74 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {“ApplicationName”:"",“CommandLine”:"–restart=always",“User”:"",“WorkingDirectory”:“C:”,“Environment”:{},“EmulateConsole”:true,“CreateStdInPipe”:true,“CreateStdOutPipe”:true,“CreateStdErrPipe”:false,“ConsoleSize”:[30,120]}.

whereas if I leave out the --restart=always
everything works fine.

Is there something else I need to do to get --restart options working on Windows?

The solution was to add the --restart=always before the other arguments

docker run --restart=always -it microsoft/nanoserver

That got me over that error, but when I rebooted the machine, the container did not restart

Can anyone confirm if --restart options are supported on windows 10?

I am using this successfully on Windows 10 v17.03.1-ce-win12, I have 2 containers in my docker instance and they both restart after a machine reboot.

What I haven’t been able to solve is the order in which they start after the reboot, I need my SQL container to initialise before my web server initialises. That is a task for another day though.

Thank’s Chris, Any chance you can give me a look at your command for the SQL Container including --restart?