Search
Close this search box.

How to Install Docker on Linux and Windows servers

Table of Contents

Easy way to Install Docker on Linux and Windows step by step Guide

 

This tutorial will guide you on a way to installation the Docker on

  • Ubuntu 18
  • CentOS 8
  • Debian 9/10
  • Windows Server 2016/2019
You may learn how to install a package from the reputable Docker repository which offers state-of-the-art strong versions. For all of the installations, the files are available from Docker legit servers, Ubuntu servers, and other locations.    

 1. Install Docker on Ubuntu 18

   

 Prerequisites

 
  • Ubuntu 18.04 or Ubuntu 19.10.
  • sudo user.
     

Step 1: Update the list of packages

      We start by updating the local databases. Open the command prompt and run
sudo apt-get update

 

Step 2: Download and install dependencies

 

 

 

This command installs dependencies to ensure that apt command transfers files securely over https.

 

 

sudo apt install apt-transport-https ca-certificates curl software-properties-common
Step 3: Add GPG key
 
This is a security feature to ensure the authenticity of the installation files.
 
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

 

Step 4: Install Docker repositories

 

Add the Docker repository to apt sources using the command

 

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

 Step 5: Update the Repositories

 

Use the command below to update the repositories just added in the previous command

 

sudo apt-get update

 

 You may want to confirm that you are running the installation from the Docker official repository using the command;

 

apt-cache policy docker-ce

 

Step 6: Install Docker

 

Use the command underneath to install the latest version of Docker.

 

sudo apt-get install docker-ce

The command installs the latest Docker, after which it starts the daemon and configures it to load automatically when the machine boots. Type Y and press Enter when prompted.

 

After it completes the manner, use the command below to confirm that the Docker installation is successful, active and running.

 

sudo systemctl status docker

 
Please note that we have used the above steps to successfully install Docker on Ubuntu 18.

 

2. Install Docker on CentOS 8

 

Prerequisites

 

  • CentOS 8
  • Sudo account

 

 

Step 1: Update Package Database

 

 

sudo yum update

Type Y for yes if prompted to download package updates.

 

Step 2: Add and enable official Docker Repository

 

sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

 

Step 3: Install stable version of the container.id package

 

The CentOS 8 does not work with some versions of container.id and gives errors when installing with the default package.

 

There are two ways of overcoming this challenge:

 

1. Deploy Docker while skipping unstable dependencies.

 

2. Manually upload the solid model of supported dependencies package.

 

Option 1: Deploy Docker while skipping unstable dependencies

 

Option 1 is to install Docker while automatically skipping packages that have broken dependencies and using the versions that meet certain specifications.

 

To do this we will use the –nobest command

 

sudo dnf install docker-ce --nobest

The system will scan the packages and dependencies and give you a list of what it will install. It will also show the packages it will skip due to broken dependencies.

 

Type Y when prompted.

 

This will skip the latest unstable package and use a previous stable version.

 

Option 2: Manually upload the solid model of supported dependencies package.

 

This method allows you to install the latest Docker but requires adding the stable container.id package manually.

 

To add the stable container.id, run

 

sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm

Install latest Docker Version on CentOS 8

 

Once the container.id is in place, you can now install Docker with the following command.

 

sudo dnf install docker-ce -y

 

Step 4: Enable and start Docker

 

You will now enable and start Docker using the command.

 

sudo systemctl enable --now docker

To confirm that Docker is active and running use,

systemctl status docker

3. Install Docker on Debian 9 and 10

 

Prerequisites

 

  • Debian 9 or 10
  • sudo user

 

Step 1: Update the installed packages

Our first step is to update the list of packages installed on Debian.

 

sudo apt update

 

Step 2: Install security package to enforce https

 

We will now install the files required to ensure that the apt will only use the https connections to transfer files to and from other computers

sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common

 

Step 3: Install GPG key to validate downloads

 

The GPG key ensures that we only obtain authentic files from the repository. To add the key, run the command below. This will return an OK.

 

 

 

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add –

 

Step 4: Add Docker repository to APT sources
 

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

 

Step 5: Update the list of packages

 

Add the just installed Docker packages to the packages database using the following command.

 

sudo apt update

 

Step 6: Install Docker on Debian

 

To install Docker now, run;

 

sudo apt install docker-ce

Type Y and press enter to continue with the installation when prompted to do so.

 

The above command will install the Docker on Debian after which it configures its engine to start on boot.

 

Use the command below to check the status and find out if the installation was successful.

 

sudo systemctl status docker

 

4. Install Docker on Windows 2016 and 2019

 

The Windows Server 2016 requires the Docker enterprise edition. The instructions below will also work on Windows Server 2019.

 

Prerequisites

 

  • Windows Server 2016 (64bit).
  • A user account with administrator rights.

 

 

Step 1: Install the Docker PowerShell module

 

Once you log in as an administrator, you will get a Windows command prompt PS C:UsersAdministrator>

 

At the prompt, type the following command

install-module -name DockerMsftProvider –Force

 

The command will appear as;

 

PS C:UsersAdministrator> install-module -name DockerMsftProvider -Force

This will return the following output with a prompt to type Y or N.

 

Type Y to proceed to install and import the NuGet provider. The computer will go back to the command prompt after a short time.

 

Step 2: Install Docker

 

Type the following command at the prompt.

 

PS C:UsersAdministrator>Install-Package Docker –Providername DockerMsftProvider -Force

The command will install the Docker package. If successful, you will see a warning message that requests you to restart the computer.

 

Step 3: Restart the computer and verify Docker is installed

 

Type the Restart-Computer command at the prompt.

 

PS C:UsersAdministrator>Restart-Computer

 

Once the computer restarts, use the following command to verify,

 

1. that Docker is installed successfully.

 

 

2. its version.

PS C:UsersAdministrator>docker version

 

 

 

 

 

 

 

That’s it!

 

 

 

 

 

Get the most out of learning with VPSie.com

Make a Comment
{{ reviewsTotal }}{{ options.labels.singularReviewCountLabel }}
{{ reviewsTotal }}{{ options.labels.pluralReviewCountLabel }}
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}
Share on
Facebook
Twitter
LinkedIn
Print
VPSie Cloud service

Fast and Secure Cloud VPS Service

Try FREE
For a month

The First 1 orders gets free discount today! Try Sign up on VPSie to get a chance to get the discount.