Step by Step Guide to Setup Docker on Linux Server

docker software

Docker is a popular platform that allows you to automate the deployment and management of applications within lightweight, portable containers. These containers bundle everything needed to run an application, including libraries and dependencies, providing consistency and efficiency across different environments. Nowadays, CryptoCurrency payment is so common. You might prefer to buy your virtual private server by Bitcoin VPS.

However, setting up Docker on a Linux server is a straightforward process, and this guide will walk you through it step by step. On a Linux server, the well-known container platform Docker is always installable. It doesn’t matter if you decide to do it when the server is still running or when you set it up.

You don’t have to use the GUI program Docker Desktop to install Docker if you use Linux. Linux users have the option of installing Docker Engine, as opposed to Windows and macOS users who must utilize the GUI to install Docker. Docker Engine uses a lot less resources than the desktop software; it just needs 1 to 2 GB of memory (RAM) to function properly. Most Linux distributions such as Ubuntu, Debian, CentOS, Fedora, Raspbian, RHEL, and SLES are supported by Docker Engine.

How to Setup Docker on Linux Server

You have everything you need with Docker to create and execute containers on a Linux machine. Similar to portable virtual machines are containers. They enable you to produce portable application images that utilize the kernel of your host’s operating system.

Let’s go through the steps of this tutorial to learn How to Install and Setup Docker on Linux Ubuntu, Debian, CentOS, and Fedora.

Step 1: Update Package Lists

Before installing Docker, it’s essential to ensure that your system has the most up-to-date package lists to fetch the latest versions. Open a terminal and run the following command:

sudo apt update

Step 2: Install Docker

To install Docker, use the package manager for your Linux distribution. Docker provides an installation script that automatically detects your system and installs the appropriate version. Run the following command on your in use Linux distribution:

On Ubuntu/Debian:

sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

To add Docker’s repository GPG key, type:

curl -fsSL | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Now, you can add the repository to your sources and update your package lists. To do this, run:

echo “deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

And finally, install Docker using the command below:

sudo apt-get install docker-ce docker-ce-cli

On Fedora:

Run the following command to add Docker’s package repository:

sudo dnf –y install dnf-plugins-core

sudo dnf config-manager —add-repo

Install Docker:

sudo dnf install docker-ce docker-ce-cli

On CentOS:

To add Docker’s package repository on CentOS, run:

sudo yum –y install yum-utils

sudo yum-config-manager —add-repo

Install Docker:

sudo yum install docker-ce docker-ce-cli

This script will install Docker and the necessary dependencies.

Step 3: Enable Docker Service

After the installation, the Docker service should start automatically. However, to ensure it’s running and enabled to start on boot, use the following commands:

sudo systemctl start docker sudo systemctl enable docker

Step 4: Verify Docker Installation

To verify that Docker is installed correctly, run the following command to check the Docker version:

docker –version

You should see the Docker version information displayed, confirming a successful installation.

Step 5: Run a Docker Container

Let’s run a simple Docker container to ensure Docker is functioning correctly. Run the following command to download and run a “hello-world” Docker container:

docker run hello-world

Docker will pull the “hello-world” image from Docker Hub and run it. You should see a message confirming a successful installation.

Step 6: Manage Docker as a Non-root User (Optional)

By default, the Docker command can only be executed by the root user or users in the docker group. If you want to manage Docker as a non-root user, add your user to the docker group:

sudo usermod -aG docker your_username

Replace your_username with your actual username. Log out and log back in for the changes to take effect.

Step 7: Docker Compose (Optional)

Docker Compose is a tool that allows you to define and manage multi-container Docker applications. You may create and operate multi-container stacks using Docker Compose. Your application’s containers are configured in a YAML file that you produce. Once all the containers are started and linked together, you can start them all with a single command. You can divide the elements of your stack into distinct containerized services using Compose.

To install Docker Compose, run the following commands:

sudo curl -L “$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose

Step 8. Managing the Docker Service

Docker’s service can be examined with systemctl to see if it is active. There are two elements to take into account: docker and containerd. The Docker Engine daemon, to which the CLI issues commands, is called docker. The underlying runtime that executes your containers is called contained. 

sudo systemctl status docker.service
sudo systemctl status containerd.service

The daemons can be controlled just like any other system services. If you want to momentarily stop Docker and release system resources utilized by your containers, use systemctl stop:

sudo systemctl stop docker.service

Restart the service with systemctl start.

How to Uninstall Docker Engine

In a required situation, run the command below to uninstall the Docker Engine, CLI, container, and Docker Compose packages:

sudo apt-get purge docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

Since containers, images, custom configuration files, and volumes would not remove automatically, use the command below to delete all of them on your host:

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd


In this article, you learned How to Install and set up Docker on your Linux server. Docker is a powerful tool that enables you to deploy and manage applications in containers, providing portability and efficiency. Explore Docker further and start deploying applications within containers to benefit from this incredible technology. Happy containerization!

Disclaimer: This article contains sponsored marketing content. It is intended for promotional purposes and should not be considered as an endorsement or recommendation by our website. Readers are encouraged to conduct their own research and exercise their own judgment before making any decisions based on the information provided in this article.


Please enter your comment!
Please enter your name here