OneBite.Dev - Coding blog in a bite size

check if docker is running

Simple docker step by step how to check if docker is running with explanation

Docker is a popular platform that facilitates creating, deploying, and running applications; hence, knowing its running status is critical.

This brief tutorial is designed to guide you through the process of checking if Docker is running on your machine in simple words.

Understanding Docker

Docker has transformed the role of software developers by providing a platform that simplifies code creation, package deployment, and application- running processes. It provides an environment that isolates the application from the system, enabling it to function consistently across multiple platforms.

Part 1: Check the Service Status

The service status of Docker can be checked through the command-line interface (CLI).

On Unix/Linux Systems:

Unix/Linux systems use SystemD to manage which services start up automatically. You can check the status of Docker by running the following command:

sudo systemctl status docker

The terminal will then display the status of Docker. If Docker is running, you will see ‘active (running)’ in the output.

On Windows Systems:

Windows users can use the Docker Desktop application to verify if Docker is running. If Docker Desktop indicates that it’s running, then Docker is active.

Alternatively, you can use PowerShell to check Docker’s status. Launch PowerShell, then type and enter the following command:

Get-Service Docker

This command will provide details about Docker, including its running status.

Part 2: Test With a Docker Command

Another way to test if Docker is running is by executing a Docker command.

Run the following command in the terminal or PowerShell:

docker version

This command will return details about the Docker client and server. If Docker is running, the server information will be displayed.

Also, you can try the command:

docker info

However, if Docker is not running, an error message will be returned.

Part 3: Running a Docker Container

To confirm that Docker can actually pull and run containers, you can do a quick test by running a simple Docker container. The “hello-world” is a Docker image which runs in a container, prints a message and exits. You can run it with a single command:

docker run hello-world

If Docker is indeed running properly, it will pull the ‘hello-world’ image from Docker Hub and run it in a new container. The program will display a welcome message, confirming that your installation appears to be working correctly.

In conclusion, to check whether Docker is running, you can either check the service status, execute a Docker command, or run a Docker container. These simple methods provide a quick and easy means of ensuring that Docker is functioning properly on your machine.

docker