To check if Docker Daemon is running, the user can use the “systemctl” command in Linux and the Docker Desktop application in Mac and Windows. Let’s first understand what Docker Daemon is, then dive into the methods for checking whether it is running.
How to Check if Docker Daemon is Running on Linux?
Docker containers and other components are managed through the Docker Engine. The Docker Engine mainly works with Docker Daemon, Docker Engine APIs, and Docker-CLI. Docker Daemon is a core component of Docker that hosts and manages the Docker containers and images. If Docker Daemon is not started or running, users are unable to use Docker and may get the error “cannot connect to Docker Daemon”.
By default, on the system, the Docker engine started automatically. In case Docker Daemon is not started, the user can execute the “systemctl start docker” command:
sudo systemctl start docker
After starting the Docker on Linux, the user needs to check if Docker Daemon is executing or not. For this purpose, the following methods can be used:
- Check Docker Daemon is Running by Using the Systemctl Command
- Check Docker Daemon is Running by Inspecting the Pid File
Method 1: Check Docker Daemon is Running by Using the Systemctl Command
In Linux, the systemctl utility is utilized to check and manage the systemd and service manager. To check if the Docker Daemon is running on Linux, simply execute the “systemctl status docker” command with sudo user rights as shown below:
sudo systemctl status docker
The output displays that the Docker service is effectively executing on Linux which means Docker Daemon is running:
Method 2: Check Docker Daemon is Running by Inspecting the Pid File
A pid file is a file that saves the executing PID that is generated by the application. If the application is in a running state, the pid file of the application exists. If the file is removed, then the application will also be terminated. So, to check if Docker Daemon is executing, inspect the pid file of Docker. For this purpose, execute the below steps.
Step 1: Read “docker.pid” File
First, read the “docker.pid” file through the “cat” command and check if Docker Daemon is executing or not:
cat /var/run/docker.pid
This will open the PID shell from which the user can run the command to filter the running threads or services that are saved in PID:
Step 2: Check Top Threads
To view the processes running in the docker pid file, execute the “top” command. This command is used to view the processes of the Linux system:
top -p 1000
Step 3: Verify Docker Daemon is Running
Users can filter the process by process name. To check if Docker Daemon is running, run the following command:
top -p `pidof dockerd`
If Docker Daemon is executing on the system, it should show some process thread as shown below:
That is how users can check if Docker Daemon is executing on Linux or not.
How to Check if Docker Daemon is Running on Windows?
On Windows, when the Docker desktop application is started, Docker Daemon will automatically start. To check if Daemon is executing on Windows, the following methods can be utilized:
- Check Docker Daemon is Running From Docker Desktop App
- Check Docker Daemon is Running From Services App
- Check Docker Daemon is Running From PowerShell
Method 1: Check Docker Daemon is Running From Docker Desktop App
To check if Daemon (Docker engine) is executing on Windows, first launch the “Docker Desktop” app via the “Start” menu. This will start the Docker engine (Daemon) on Windows. From the left bottom corner user can check if the Docker engine is running or not as pointed out below:
The above output shows that Docker Daemon is executing on Windows.
Method 2: Check Docker Daemon is Running From the Services App
The Service app is a Windows built-in app used by an administrator to manage and monitor the services running on the Windows. To check if Docker Daemon is executing, first launch the “Services” app via the Start menu:
Next, find the “Docker Desktop Service” and check the status of the service. The below result shows that the “Docker Desktop” service is executing which means the Docker Daemon backend process of the Desktop application is also executing:
Method 3: Check Docker Daemon is Running From PowerShell
We all know that Docker cannot run directly on the system. To operate the Linux containers on Windows, docker will either run on Hyper V or WSL. Usually, the Docker application is executed on Windows through WSL.
To check if Docker Daemon is executing on WSL from Windows PowerShell, first launch the PowerShell with the administrator rights:
Next, execute the below command to list down services running on WSL:
wsl -l -v
Here, you can see “docker-desktop” services are executing which means Docker Daemon is also running on the Windows system:
If you are using Docker on macOS, follow the below section.
How to Check if Docker Daemon is Running on MacOS?
Similar to Windows, the Docker Desktop application is used for MacOS. By starting the desktop application, Docker Engine(Docker Daemon) will automatically start. To verify if Daemon is executing on Mac, follow the listed methods:
- Check Docker Daemon is Running From Docker Desktop App
- Check Docker Daemon is Running From Terminal
Method 1: Check Docker Daemon is Running From Docker Desktop App
First, navigate the Application folder using Mac Finder. After that, launch the Docker Desktop app. This will automatically start the Docker engine with the Docker application that can be verified from the left bottom corner:
The above result indicates that Docker Daemon is executing on Mac.
Method 2: Check Docker Daemon is Running From Terminal
On Mac, the user can check service status through various commands. In this section, we will use the following commands to check whether Docker Daemon is executing or not:
- Grep Command
- Top Command
- Launchctl Command
Grep Command
To verify if the Daemon service is running on Mac, execute the method command:
ps -ef | grep docker
The above command “ps” will access the running process then, the “grep” command to filter the “docker” processes only:
The output shows the Docker is running on MacOS:
Top Command
The top command is also used to show the Mac running services and processes. To view all running processes, execute the “top” command:
top
Here, the below-pointed process indicates that Docker Daemon (Docker Engine) is executing:
Launchctl Command
Another way to manage the Mac services is by using the “launchctl” utility. To check if Docker Daemon is executing, list down Mac executing services through the “launchctl list” command:
sudo launchctl list
The below-pointed thread shows that the Docker engine is effectively executing on Mac:
That is how users can check if Docker Daemon is executing on Windows, Linux, or macOS.
Conclusion
To check if the Docker daemon is executing on Linux, either execute the “systemctl status docker” command or view the docker pid file. On Windows, the user can check whether the Docker engine is running or not from the Docker Desktop application or listing services running on WSL through the “wsl -l -v” command. On macOS, the user can either use the Docker Desktop application, or the “ps -ef | grep docker” command. We have provided the techniques to verify if Docker Daemon is executing on the system or not: