|
How to Start Docker Daemon as a Windows Service with AlwaysUp |
Automatically launch Docker Daemon as soon as your Server boots and keep it running 24/7 in the background. No need to log on!
Docker automates the deployment of applications inside software containers.
Docker Daemon, an important component designed to run in the background, manages those containers using the Docker Remote API.
Note: You no longer need AlwaysUp to run Docker Daemon as a Windows Service
Even though you won't find it in the
standard documentation for Docker Daemon,
the Windows version of dockerd supports running as a native Windows Service — without third-party tools like AlwaysUp.
To install Docker Daemon as a native Windows Service:
-
If necessary, download and install
Docker Desktop
(recommended) or the
Docker server and client binaries.
We installed Docker Desktop version 4.12.0
on our Windows Server 2022 machine for this tutorial.
-
Open a command prompt with elevated/admin rights.
Change the directory (CD) to where "dockerd.exe" lives. Since we installed Docker Desktop, the directory on our server is:
C:\Program Files\Docker\Docker\resources
Of course, your folder may be different.
-
Run this command to install the Docker Daemon service:
dockerd --register-service
The command completed successfully on our server:
-
That's it!
To confirm that the service was installed, launch the
Services
application.
(You will find it in Control Panel or you can run "services.msc" to start it.)
Find "Docker Engine" in the list of services and double-click the entry to open the service's properties:
Note that the service won't be running. Feel free to start it now —
or you can wait for Windows to start it automatically the next time your computer boots.
Unless you're running a very old version of Docker, you don't need to follow the instructions below.
They remain on this page for historical purposes only.
To install Docker Daemon as a Windows Service:
-
If necessary, download and install Docker for Windows. We have installed
Docker Toolbox for this tutorial but all you need is the Docker executable.
-
Download and install AlwaysUp, if necessary.
-
Start AlwaysUp.
-
Select Application > Add to open the Add Application window:
-
On the General tab:
-
In the Application field, enter the full path to the Docker executable, Docker.exe. Since we have installed Docker Toolbox in the default location, we will enter:
C:\Program Files\Docker Toolbox\Docker.exe
-
In the Arguments field, enter the parameters to run Docker in daemon mode. The first parameter must be "daemon" and it should be followed by
whatever other flags you wish to use for your environment.
We will specify the debug flag (--debug) as Docker on Windows is still young.
-
In the Name field, enter the name that you will call the application in AlwaysUp.
We have used Docker Daemon but you can specify almost anything you like.
Note @ 1/25/2019: The Docker command line tools have changed. You should run Dockerd.exe, instead of Docker.exe, and drop the "daemon" parameter.
Please see the current
dockerd command line reference to
compose the flags that make sense for your situation.
-
Click over to the Startup tab and check the Ensure that the Windows Networking components have started box.
This informs AlwaysUp that Docker needs the TCP/IP networking stack to operate.
-
Next, switch to the Extras tab. If you wish to capture the output written to the Docker console, check the Capture output to this log file box and enter the full path to the text
file that will record the output.
We also recommend checking the Automatically trim... option below to prevent the file from growing too large.
-
Click the Save button. In a couple of seconds, an entry called Docker Daemon (or whatever you called it) will show up in the AlwaysUp window.
It is not yet running though.
-
To start Docker in daemon mode, choose Application > Start "Docker Daemon". The state should transition to "Running" after a few seconds and Docker Daemon should be accessible over the remote bridge.
-
That's it! Next time your computer boots, Docker Daemon will start up immediately, before anyone logs on.
We encourage you to edit the Docker entry in AlwaysUp and check out the many other settings that may be appropriate for your environment.
For example, send an email if Docker stops, run a customized failure detection script, and much more.
Docker Daemon not working properly as a Windows Service?
Consult the AlwaysUp Troubleshooter —
our online tool that can help you resolve the most common problems encountered when running an application as a windows service.
From AlwaysUp, select Application > Report Activity > Today to bring up an HTML report detailing the interaction
between AlwaysUp and Docker Daemon.
The AlwaysUp Event Log Messages page explains the messages that may appear.
Browse the AlwaysUp FAQ
for answers to commonly asked questions and troubleshooting tips.
Contact us and we'll be happy to help!
|
Over 94,000 installations, and counting!
|
|
|
Rock-solid for the past 19+ years!
|
Fully Compatible with 160+ Applications...
|