OneBite.Dev - Coding blog in a bite size

run docker daemon

Simple docker step by step how to run docker daemon with explanation

Running Docker daemon involves a series of steps for effective container management during development. This article will provide a simple, step-by-step tutorial on how to accomplish this task.

Introduction

In a nutshell, Docker daemon (also called Dockerd) is a persistent process that manages Docker containers.

Prerequisites

Before starting, ensure that Docker is installed on your system. If it isn’t, you can download it from the official Docker website.

Step 1: Start Docker Daemon

To start Docker daemon, open your command line interface and use the following command:

sudo systemctl start docker

This command begins the Docker daemon.

Step 2: Enable Docker Daemon at Startup

Often, you might want Docker to automatically start whenever your system boots. To achieve this, use the following command:

sudo systemctl enable docker

This command makes Docker start automatically at system startup.

Step 3: Confirm Docker Daemon is Running

To ensure Docker daemon is up and running, use the status command as shown below:

sudo systemctl status docker

If Docker daemon is running, you should see an output with “active (running)” written on it.

Step 4: Running Docker without Sudo

By default, Docker commands require the use of sudo. This could be inconvenient. To avoid the repeated use of sudo when running Docker, add your username to the Docker group. Use the following command for this:

sudo usermod -aG docker ${USER}

After executing the command, log out and log back in so that your group membership is re-evaluated.

Important Note

Remember, running Docker daemon in the background means any containers you launch will continue running until you explicitly stop them. Ensure to stop any containers when not in use to conserve system resources.

Conclusion

The article has demonstrated the basic steps required to start and enable Docker daemon on your operating system. It also showed how to ensure Docker can be run without sudo, making the process smoother and less restrictive. By following these simple steps, you can effectively manage Docker and enjoy the full benefits it offers through containerization.

docker