To coordinate with and manage Docker Components, Docker Daemon must be started. To start, restart, or stop Docker Daemon, the “systemctl” command is used on Linux, the Docker Desktop application on Windows, and the “launchctl” command on Mac OS.
So, let’s get started!
What is Docker Daemon
Docker Daemon is a process or service that is running in the backend. It hosts the Docker containers, images, and network. The Docker Engine API is used to get the request from the client and send a request to Docker Daemon to manage the container and other components accordingly. Docker CLI is the Docker client command line tool that is used to manage and run Docker components. Docker Daemon must be started to interact with and play with Docker components.
How to Start, Restart, and Stop Docker Daemon on Linux?
Typically, Docker Daemon is started by system utility automatically on a system started in Linux. However, if the user wants to manually manage the Docker Daemon on Linux, go through the following illustration:
- Stop Docker Daemon in Linux
- Start Docker Daemon in Linux
- Restart Docker Daemon in Linux
Stop Docker Daemon in Linux
To stop Docker Daemon (Docker) completely in Linux, follow the below steps.
Step 1: Check Docker
To verify if Docker is executing on system or not, run the “ docker info ” command:
docker info
The output shows the detailed summary of the installed Docker Engine and existing containers and images:
Step 2: Stop Docker Daemon
To start the Docker daemon on Linux, utilize the “ systemctl stop docker ” command with sudo user rights:
sudo systemctl stop docker
The below warning shows that Docker is still activated because of the Docker socket:
Step 3: Stop Docker Socket
To completely stop the Docker on Linux, try to stop the “ docker.socket ” service using the “ systemctl ” command:
sudo systemctl stop docker.socket
Step 4: Check Status
For verification, check the docker service status using the “ systemctl status ” command:
sudo systemctl status docker
The below result shows that we have effectively stopped the Docker:
Start Docker Daemon in Linux
To start the Docker Daemon in Linux, the user can directly run Docker Daemon manually and also use the “ systemctl ” command to activate the Docker service.
Start Docker Daemon Manually
To manually start the Docker Daemon on Linux, utilize the “ dockerd ” command:
sudo docker
This will start the Docker Daemon on Linux:
Start Docker Daemon Using the “systemctl” Command
To start the Docker Daemon using the “systemctl” command, go through the below instructions:
Step 1: Start Docker Socket
The Docker socket is the Unix socket that enables the communication between the Docker client and Docker Daemon. To start the Docker socket service, run the below command:
sudo systemctl start docker.socket
Step 2: Start Docker
Now, start the “ docker ” service to run the Docker Daemon using the mentioned command:
sudo system start docker
This will start the Docker service on Linux:
Note: Sometimes, while starting the Docker service, the user may encounter the error “ Job for docker.service failed ” as shown below. This error occurs due to an unknown cause or clash in processes:
To fix the stated issue, try out the below section.
Bonus Tip: How to Fix “Job for docker.service failed” Error?
While starting the Docker Daemon service, sometimes users encounter the error “Job for docker.service failed”. This error occurs if Docker is already running in Linux, or some other process occupies the port on which Docker tries to start.
To fix the “Job for docker.service failed” issue, try out the below steps.
Step 1: Debug Docker Daemon Process
First, debug the Docker Daemon using the “ dockerd –debug ” command. This command requires “ sudo ” rights:
sudo dockerd --debug
The below output suggests that remove the “ /var/run/docker.pid ” process. This is stopping the Docker from starting Docker service:
Step 2: Remove Suggested Process
Now, remove the suggested process using the “ sudo rm -rf <suggested-path> ” command:
sudo rm -rf /var/run/docker.pid
After that, the user may be required to restart the system.
Step 3: Start Docker Service
Now, start the Docker Daemon by starting the “ docker ” service using the below command:
sudo system start docker
Here, we have effectively fixed the encountered issue:
Restart Docker Daemon in Linux
In order to restart the Docker Daemon on Linux, restart the Docker service using the “ systemctl restart docker ” command as done below:
sudo systemctl restart docker
How to Start, Restart, and Stop Docker Daemon on Windows?
On Windows, Docker is installed through the Docker Desktop application. This application includes all the essential packages and plugins that are used to operate and run the Docker environment. When a user starts the “ Docker Desktop ” application, it will directly start the Docker Engine.
To start, restart, and stop Docker Daemon on Windows, users can either use the Docker Desktop application or the “ services.msc ” utility.
Start, Restart, and Stop Docker Daemon Using Docker Desktop
To manage the Docker Daemon using Docker, first, launch the Docker Desktop app via the Windows Start menu:
This will take some time to start the Docker engine automatically. From the left bottom corner, you can see the Docker Daemon (Docker engine) is executing . To stop or restart the Docker Daemon, the user can use below pointed pause and play buttons:
Start, Restart, and Stop Docker Daemon Using “services.msc” Utility
Another possible way to manage the Docker Daemon is through the “ services.msc ” utility. Services is a Windows built-in utility that is utilized to manage the Windows processes and services. To start, stop, and restart Docker Daemon, go through the following steps:
Step 1: Launch Services App
Open the Windows Services app by searching “ Services ” in the Start menu:
Alternatively, the user can run the “ services.msc ” command in PowerShell to launch the Window Services app:
services.msc
Step 2: Start, Stop, or Restart Docker Daemon
Now, find the “ Docker Desktop ” or “ Docker ” service. Select the service and click on “ Stop ” to stop the service. If the user wants to restart the service, press the below pointed “ Restart ” option:
How to Start, Restart, and Stop a Docker Daemon on Mac?
Similar to Windows, Mac also supports the Docker Desktop system and users can manage the Docker engine from applications easily as explained in the above section. Another way to manage the Docker Daemon is the “ launchctl ” utility. This utility supports the “ start ” and “ stop ” commands to start and stop the Mac services and processes.
Start Docker Daemon
To start the Docker engine (Daemon) in Mac OS, run the “ sudo launchctl start <service-name> ” command:
sudo launchctl start com.docker.docker
Stop Docker Daemon
Similarly, to stop the Docker Daemon service on Mac, execute the “ sudo launchctl stop ” command:
sudo launchctl stop com.docker.docker
We have illustrated the methods to start, stop, and restart Docker Daemon on Windows, Mac, and Linux.
Conclusion
To start, restart, or stop the Docker Daemon on Linux, utilize the “ sudo systemctl start docker ”, “ sudo systemctl restart docker ”, or “ sudo systemctl stop docker ” commands respectively. To manage the Docker Daemon on Windows, users can use the Docker Desktop application or the “ services.msc ” utility. On Mac, the user can stop the Docker Daemon using the “ sudo launchctl stop com.docker.docker ” command and start the Daemon using the “ sudo launchctl stop com.docker.docker ” command. This article has provided the techniques to start, stop, and restart Docker Daemon on Linux, Windows, and Mac OS.