For developers, system administrators, and DevOps engineers working with Docker on Linux, knowing whether Docker is running is essential for troubleshooting and automation. This listicle covers 10 reliable Linux commands to verify Docker’s status, each with specific details on what the command does and why it’s useful. Whether you’re scripting checks or manually verifying Docker’s health, these commands provide practical ways to confirm that your Docker daemon is up and operational.
1. systemctl status docker
This command checks the status of the Docker service using systemd, the init system on most modern Linux distributions like Ubuntu, CentOS, and Debian. Running systemctl status docker returns detailed information including whether the service is active, inactive, or failed, along with recent logs. It’s the most straightforward and recommended approach to check if the Docker daemon is running on systems that use systemd.
2. service docker status
On older Linux distributions or those without systemd, the service command is used to check Docker’s status. Executing service docker status provides a simpler output indicating if the Docker service is running or stopped. This command is especially useful on SysVinit or Upstart-based systems where systemctl is not available.
3. docker info
The docker info command queries the Docker daemon directly and returns detailed information about the Docker installation including server version, number of containers, images, and storage driver. If Docker is not running, this command will fail with an error such as “Cannot connect to the Docker daemon.” Thus, it’s a reliable way to verify not only if Docker is running but also if it is responsive.
4. docker version
This command prints the client and server versions of Docker. When the Docker daemon is running, docker version shows both the client and server details. If the server (daemon) is not running, it will only show the client version and produce an error for the server section. This makes it a quick way to confirm daemon availability.
5. ps aux | grep dockerd
This command lists all processes and filters for the Docker daemon process called dockerd. If the Docker daemon is running, you should see a process line for dockerd along with its PID and command-line arguments. This is a low-level check that bypasses service managers and directly confirms the process presence.
6. pidof dockerd
The pidof command returns the process ID(s) of running programs. Running pidof dockerd will output the PID if the Docker daemon is active or nothing if it is not. This is a simple and script-friendly check to detect if the Docker daemon process exists.
7. netstat -lntp | grep dockerd
Docker daemon listens on a Unix socket and optionally on a TCP port. Using netstat -lntp | grep dockerd shows if the Docker daemon is listening for TCP connections, which indicates it’s running. This command also reveals the ports Docker is bound to, useful for remote Docker setups or troubleshooting network connectivity.
8. ss -lntp | grep dockerd
The ss command is a modern replacement for netstat. Running ss -lntp | grep dockerd displays listening TCP sockets associated with the Docker daemon process. It’s faster and more informative than netstat and preferred on newer Linux systems.
9. docker container ls
This command lists all running containers. If Docker is not running, the command will fail to connect to the daemon. Thus, a successful listing confirms the daemon is active. While it’s not a direct status check, it’s practical when you want to verify both daemon status and container operations.
10. journalctl -u docker
This command queries the systemd journal logs for the Docker service. Running journalctl -u docker shows logs related to Docker startup, shutdown, and runtime events. Reviewing these logs helps confirm if Docker started correctly or if it encountered errors, offering deeper insight beyond just “running” or “not running.”
How to Choose
Choosing the right command depends on your Linux distribution, environment, and what you need to verify. For systemd-based systems, systemctl status docker is the most reliable and informative. For older systems without systemd, service docker status is your fallback. Commands like docker info and docker version test direct communication with the daemon, making them useful for scripting and confirming responsiveness. Process checks (ps, pidof) are universal but less descriptive, best for quick presence checks. Network socket checks (netstat, ss) help when Docker is configured for remote API access or troubleshooting connection issues. Finally, examining logs with journalctl is essential for diagnosing startup problems or unexpected failures.
Frequently Asked Questions
How can I tell if Docker daemon is running without root privileges?
You can run docker info or docker version as a non-root user if you are in the Docker group. If you get a permission denied error, you either need root or to be added to the Docker group.
What does “Cannot connect to the Docker daemon” mean?
This error means the Docker client cannot reach the Docker daemon, usually because the daemon is stopped, crashed, or user permissions are insufficient.
Is checking the dockerd process enough to confirm Docker is running?
While seeing the dockerd process means the daemon is running, it doesn’t guarantee it’s functioning correctly. Using docker info or service commands gives more complete status.
Why might systemctl status docker show active but Docker commands fail?
The daemon might be running but misconfigured, or socket permissions may prevent client connection. Checking Docker logs with journalctl -u docker can help diagnose.
Can I check Docker status remotely?
If Docker’s API is exposed over TCP, you can use curl or docker info pointed at the remote host. Otherwise, SSH into the host and run local checks.
What’s the difference between docker info and docker version for status checks?
docker info provides detailed runtime and configuration info, while docker version mainly shows client and server version numbers. Both fail if the daemon is unreachable, but docker info is more comprehensive.
Final Thoughts
Verifying Docker’s running status on Linux is a foundational skill for anyone managing containerized workloads. The commands covered here offer multiple angles—from service managers and process checks to direct Docker client queries and network diagnostics. Choosing the right tool depends on your environment, distribution, and what aspect of Docker’s health you need to confirm. Combining these commands can provide a robust approach to monitoring and troubleshooting Docker installations effectively.
Related
- Air Fryer Kielbasa Pigs in a Blanket Recipes and Tips
- Remove Form Control Checkbox from Excel Sheet: 10 Easy Methods
- Seeing a Shoebill Without a Guide: Is It Really Possible?