Installing Docker: Diving into Docker — Part 3

Girish Kumar Adari
5 min readMay 1, 2020

--

There are loads of ways and places to install Docker. There’s Windows, there’s Mac, and there’s obviously Linux. But there’s also in the cloud, on premises, on your laptop, and more… On top of those, we’ve got manual installs, scripted installs, wizard-based installs… There literally are loads of ways and places to install Docker! In this story we’ll cover some of the most important installs:

  • Desktop installs — Docker for Windows
  • Server installs — Linux

We’ll also look at upgrading the Docker Engine and selecting an appropriate storage driver.

Installation of Docker for Windows

The first thing to note is that Docker for Windows is a “packaged” product from Docker, Inc. This means it’s easy to download and has a slick installer. It spins up a single-engine Docker environment on a 64-bit Windows 10 desktop or laptop.

The second thing to note is that it is a Community Edition (CE) app. So it’s not intended for production.

The third thing of note is that it might suffer some feature-lag. This is because Docker, Inc. is taking stability first, features the second approach with the product. All three points add up to quick and easy installation, but one that is not intended for production.

Let’s see how to install Docker for Windows. First up, pre-requisites. Docker for Windows requires:

  • Windows 10 Pro | Enterprise | Education (1607 Anniversary Update, Build 14393 or newer)
  • Must be 64-bit Windows 10
  • The Hyper-V and Containers features must be enabled in Windows
  • Hardware virtualization support must be enabled in your system’s BIOS

it’s time to install Docker for Windows.

  1. Head over to https://www.docker.com/get-docker and click the GET DOCKER COMMUNITY EDITION link.
  2. Click the Download from Docker Store link beneath the DOCKER CE FOR WINDOWS section. This will take you to the Docker Store and you may need to login with your Docker ID.
  3. Click one of the Get Docker download links. Docker for Windows has a stable and edge channel. The edge channel contains newer features but may not be as stable. An installer package called Docker for Windows Installer.exe will be downloaded to your default downloads directory.
  4. Locate and launch the installer package downloaded in the previous step.

Step through the installation wizard and provide local administrator credentials to complete the installation. Docker will automatically start, as a system service, and a Moby Dock whale icon will appear in the Windows notifications tray. Now we can run Docker from command prompt/Powershell.

Installation of Docker for Linux

Installing Docker on Linux is the most common installation type and it’s surprisingly easy. The most common difficulty is the slight variations between Linux distros such as Ubuntu vs CentOS.The first thing you need to decide is which edition to install. There are currently two editions:

  • Community Edition (CE)
  • Enterprise Edition (EE)

Docker CE is free and is the version we’ll be demonstrating. Docker EE is the same as CE, but comes with commercial support and access to other Docker products such as Docker Trusted Registry and Universal Control Plane. In this example, we’ll use the wget command to call a shell script that installs Docker CE.

Ensure that your system is up-to-date with the latest packages and security patches before continuing.

Sudo root access

Make sure you have sudo/root access of your Ubuntu server or desktop where you are planning to set Docker CE.

To install Docker on Ubuntu, in the terminal window enter the command:

sudo apt install docker.io

To install Docker on Ubuntu for docker repository:

Step 1: Update Ubuntu System

To confirm all the packages on your system are up to date and upgraded to their latest version, use the below two commands:

sudo apt-get install updatesudo apt upgrade

Step 2: Enable HTTPS for repositories

To install Docker we use apt and here we are allowing it to have the capability to fetch different packages from repositories over https protocol.

sudo apt-get install apt-transport-https

Step 3: Install a few required packages

sudo apt-get install ca-certificates curl gnupg-agent software-properties-common

Step 4: Add GPG of Docker

To make sure that whatever packages we are receiving for Docker installation are from the authentic and official source, thus add Docker’s official GPG key.

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

We can now verify the fingerprint of the above added Key, run the below command and match the output. It should reply with 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.

sudo apt-key fingerprint 0EBFCD88

Step 5: Add Docker’s official repository on Ubuntu

To tell the Ubuntu where are the installation packages of Docker’s are residing to download, we have to add the repository of Docker. Run the below command:

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

Again update the system (if needed):

sudo apt-get update

Step 6: Command to install Docker CE on Ubuntu 19.04/18.04…

Now everything has been already setup up for Docker installation its time to perform it.

To install the docker, docker command line (CLI) and Docker container.io you can simply type a command:

sudo apt-get install docker-ce

To Check installed docker version

After installing, if you want to check the installed docker’s version then use this command:

apt-cache madison docker-ce

Step 7: Manually Start Docker

After installing docker, in case the docker has not started automatically then use the below command to do that manually.

If your system has been booted with systemd as init then use the systemctl command to start it.

sudo systemctl start docker

Else use the service command:

sudo service docker start

Step 9: Test Docker CE is installed correctly

Now we do a small docker test to check whether docker services are running perfectly.

sudo docker --version  // gives the details of installed docker
sudo docker run hello-world

Step 9: Access the Docker CLI without needing root access

To save yourself using sudo again and again for docker’s command to run, add its user to root group

sudo usermod -aG docker $USER

Step 8: Use Docker to install ubuntu image

Here is the command to pull the docker image of Ubuntu for its quick installation.

docker pull ubuntu:latest

To uninstall docker from ubuntu

Hereafter, in case you want to uninstall Docker from Ubuntu then we can use this single command:

sudo apt remove docker*
or
sudo apt-get purge docker-ce

Next part covers the commands for working with docker https://medium.com/@adari.girishkumar/basic-commands-diving-into-docker-part-4-74296e824b89

--

--