Docker is an open-source project that supports building, testing, deploying, and managing applications in self-sufficient, portable containers. Generally, the container images have all the resources that an application requires to run.

Today, Docker has become a popular tool for deploying and managing applications as containers while overcoming compatibility issues. The technology allows you to install the apps and services on a wide range of computers regardless of the underlying hardware and operating systems. Consequently, you can run such images on different computer systems as long as Docker is installed. Typical images include Nginx, MariaDB, WordPress, and others. Docker is different than traditional VM. In this tutorial, you will learn how to install the Docker on the following operating systems.

Ubuntu Debian CentOS Windows

In most cases, the steps are similar for a particular OS, but there might be some slight variations across different versions.

Docker installation methods

Generally, there are three main Docker installation methods, the choice of which depends on the situation and environment, as explained below.

Using the Docker repositories: – Easy to install and upgrade method recommended for most online installations. Manual download, installation, and upgrades: – suitable for offline computers that have no access to internet Using automated scripts: for development and testing environments.

In this guide, we will discuss the installation using the Docker repositories. You will learn how to install and upgrade the tool from the official Docker repositories. Generally, you can also download the files from the operating system’s repository, but this may not have the latest versions hence the need to use the official Docker source whenever possible.

Install Docker on Ubuntu

For this article, we will use Ubuntu 18.04.

Prerequisites

Ubuntu 18.04 sudo user

Step 1: Update the local database

Before installation, start by updating the existing list for packages

Step 2: Install dependencies that support https

Install packages that will allow apt to transfer files over https This is what each command does;

apt-transport-https: Allow apt to transfer files and data over https ca-certificates: make the computer or browser to check security certificates curl: A file transfer tool software-properties-common: adds software management scripts

Step 3: Add Docker’s GPG Key

The next would be to add the GPG key – a security feature that ensures the installation files are authentic.

Step 4: Install the Docker Repository

In this step, use the command below to add the Docker repository to the apt sources.

Step 5: Update Repositories

Update the database with the Docker packages from the repo you have just added To ensures that you are running the installation from the official Docker repository, run the command This should give the following output Output of apt-cache policy docker-ce From the output, you will notice that the docker-ce is not yet installed. However, the output will show the target operating system and the version number of the Docker. Please note that version numbers may differ depending on the time of installation.

Step 6: Install Latest Version of Docker

Once confirmed, use the following command to install Docker. This will install Docker, start the daemon and enable it to automatically start on boot. To confirm that the Docker is active and working, run; If installed and running successfully, the command will provide the following output This part of the output shows that the installation was successful and that Docker is active and running.

Installing Docker on CentOS

Prerequisites

A stable version of CentOS 7 Sudo user

The best practice is to use the latest version of the Docker installation package from the official Docker repository.

Step 1: Update package database

The first step is to update the package database with the command.

Step 2: Add Docker Repository and install Docker

After updating, we will add the official Docker repository, download, and install the latest version of Docker. To do this, use the command;

Step 3: Start Docker and check its version

Once the installation is complete, start the Docker daemon Confirm that Docker is running This should provide the following output

Installing Docker on Debian

To ensure that you get the latest version, install from the official Docker repository.

Prerequisites

Step 1: Update system

First, update the list of installed packages.

Step 2: Install the packages required to run apt to over Https

Step 3: Add GPG key

Now we need to add the GPG key from Docker to our Debian system. This ensures that the downloads are valid. To add the GPG key for the official Docker repository, run

Step 4: Add the Docker repository to the APT sources

In this step, you will add the Docker repository to the apt sources.

Step 5: Update package database

We are now going to update the package database with the Docker packages from the repo you have just added.

Step 6: Verify the installation source

The command below ensures that you are installing the Docker from the official Docker repo instead of Debian’s which may be outdated. This will return an output similar to the one below. However, Docker’s version number may vary. As can be seen, the docker-ce is not yet installed. The output shows that the installation is from the official Docker repository for Debian 9 (stretch).

Step 7: Install Docker

We are now ready to install Docker using the command below. This will install Docker, start the engine and configure it to always start on boot.  After the installation is complete, verify that it is running. If installed successfully, the output will indicate that the service is active and running. Output

Install Docker on windows

Let’s see how to install Docker enterprise edition on Windows server 2016.

Step 1: Install the Docker Powershell module

Open the Window’s PowerShell command prompt with an administrative account, and use the command below to install the DockerMsftProvider module. This is a Docker Powershell module for finding, installing and updating Docker images. If using the administrator account, the command will appear as; This will give the output as below.

Step 2 Install Docker Package

After the module is in place, we are now ready to install the Docker package.

This will install the Docker package on the computer but it will not start the service. As such, you must restart the computer to enable the container feature. After the restart, verify the installation and version by running Output To test Docker with a typical image, run the command If installed and running properly, the command will give the following output. Please note that you must use a windows container image by default. In case you need to run Linux container images, use the Docker Daemon in the experimental mode, which is available in the desktop version. Conclusion I hope now you know how easy is to install Docker. Once you installed, play around with it to get familiarize and if you need some video-based training then check out this course.

How to Install Docker on Ubuntu  CentOS  Debian and Windows - 16How to Install Docker on Ubuntu  CentOS  Debian and Windows - 43How to Install Docker on Ubuntu  CentOS  Debian and Windows - 82How to Install Docker on Ubuntu  CentOS  Debian and Windows - 81How to Install Docker on Ubuntu  CentOS  Debian and Windows - 29How to Install Docker on Ubuntu  CentOS  Debian and Windows - 44How to Install Docker on Ubuntu  CentOS  Debian and Windows - 42How to Install Docker on Ubuntu  CentOS  Debian and Windows - 15