How to install Docker on Linux?

First published: Thursday, November 30, 2023 | Last updated: Thursday, November 30, 2023

Learn simple ways to install Docker on Linux-based operating systems to manage OCI images and containers.


What is Docker?

Docker is a set of coupled SaaS and PaaS products that use operating system level virtualization to develop and deliver software in packages called containers.

Install Docker

Before carrying out a new Docker installation, it’s vital to remove any previous Docker installations. This knowledge base article specifically covers the installation of Docker Community Edition (CE), the open source version of Docker. It is advisable to install Docker using a package manager on Linux-based operating systems. After completing the installation, it’s important to verify the Docker version to confirm that the installation was successful. For further information, please visit the Docker documentation.

Linux (RPM)

You can use the following commands to install Docker in RPM-based Linux operating systems such as CentOS LinuxRed Hat LinuxFedora LinuxAmazon LinuxAlma LinuxRocky Linux, etc., or any other similar equivalents.

# Install required system packages.
$ sudo yum install yum-utils device-mapper-persistent-data lvm2

# Add Docker repository to package manager source list.
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# Install Docker, Docker client, and Containerd.
$ sudo yum install docker-ce docker-ce-cli containerd.io

# Check Docker version.
$ docker --version

# Check status of Docker service.
$ sudo systemctl status docker.service

# Enable Docker service at boot.
$ sudo systemctl enable docker.service

Linux (Debian)

You can use the following commands to install Docker in Debian-based Linux operating systems such as Ubuntu LinuxMint LinuxKali LinuxKubuntu Linux, etc., or any other similar equivalents.

# Remove old Docker installations to make fresh install.
$ sudo apt remove docker docker-engine docker.io containerd runc

# Check for package updates.
$ sudo apt update

# Install required system packages.
$ sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

# Add Docker's official GPG key to package manager.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88

# Add Docker repository to package manager source list.
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

# Install Docker, Docker client, and Containerd.
$ sudo apt install docker-ce docker-ce-cli containerd.io

# Check Docker version.
$ sudo docker --version
 
# Enable Docker service at boot.
$ sudo systemctl enable docker.service

Logo of SloopStash organization.

Interested in our products, open source works, training, or solutions?

Just send us a message, we're here to support you. Feel free to reach out anytime for assistance.


Contact us