Search code examples
docker-for-windows

Getting Docker Windows Containers to start automatically on reboot


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?


Solution

  • Parameters shall be coming before image:tag in CLI