Reputation: 107
I have a windows service that I want to run in a docker container on Azure. I would like to have the same setup when running the service locally, so I would like to run the same docker container locally as a windows service (I think?).
How would I do that? Or is there a better approach?
Thanks, Michael
Upvotes: 2
Views: 7408
Reputation: 81
IMHO Michael asked how to start docker images without the need to have a user logged in. The docker restart flag actually only deals with starting images after docker is running. To get docker to run without logged in user (or after automatic windows updates) it seems to me you will also need to make a windows service that runs docker.
A good explanation for this part of the problem can be found here (no good solution has been found yet without paying for it - docker team ignored request to make this work without third party so far): How to start Docker daemon (windows service) at startup without the need to log-in?
Upvotes: 3
Reputation: 4033
You can use the flag --restart=unless-stopped
with the docker run
command and the docker container will run automatically even if the server was shutdown.
Further read for the restart policy and flag here
but conditions apply - docker itself should always run on startup. which is default setting by itself.
Upvotes: 2