How to install docker on Linux

How to install docker on Linux
5/5 - (9 votes)

Docker has become an essential part of many projects because of the flexibility and advantages it gives a development team. In this post we take the first step in our blog on the road to learning Docker: how to install Docker on Linux.

Before we start, let’s answer a common beginner question: what is the difference between Docker Desktop and Docker Engine? You can use both to develop and deploy your application, but the core daemon that runs your APIs and everything else is Docker Engine. Docker Desktop includes a virtual machine with the Docker packages inside.

You can install Docker Engine on a variety of systems, such as Mac, Windows and Linux. The table below shows the supported distributions.

install docker on linux

In this post we install Docker on CentOS. Ubuntu is another very popular distro for dockerizing your production environment, and most commands are the same once Docker is installed and you want to run it on your server.

There are several ways to install Docker on Linux. Many private companies prefer to create their own repository and use it to install and update Docker; you can learn more in this guide. Here we stick to the simpler, more general method of using a package manager.

To install Docker on Linux:

  • Add the Docker repository:
sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
  • Install Docker Engine and Docker Compose (we’ll explain them later):
 sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  • Start Docker:
sudo systemctl start docker
  • Validate your installation by downloading and running an image:
 sudo docker run hello-world 

install docker on linux server

You’re all set. Now that you have installed Docker on Linux, we will look at many interesting projects built with it in our upcoming posts.

Related articles

nslookup practical commands

Anyone who works in IT has run into a failed DNS request at least once, and it can be frustrating. In this…