What is Docker?

Docker is a popular containerization platform that allows you to run applications in their own isolated environments. Containerization is often seen as the next evolution of virtualization technology and is often run within virtual machine environments for extra security.

Ubuntu is one of the more popular Linux distributions due to user familiarity and stability.

Today we’re going to install docker on Ubuntu 19 “Disco Dingo” as well as show you how you can access a list of Docker Commands.

The “Easy” Way

There is a script which drastically shortens the amount of time and commands needed to install docker. Here’s the script:

Step 1: type: curl -fsSL https://get.docker.com -o get-docker.sh

Step 2: type sudo sh get-docker.sh

And that’s really it. Those 2 commands should get docker installed on your system.

The “Traditional” Way

Preparations

Before actually installing Docker on Ubuntu we are going to have to prepare some things like downloading repos and making sure docker is being downloaded from the proper source to take advantage of the latest release.

Steps

  1. If you are using the Ubuntu GUI, you will need to locate and open the terminal application. Sometimes this is hidden. If you can’t see it listed in the application drawer on the dock, just search for ‘terminal’ and it will show up.

Ubuntu TerrminalOpen Terminal

  1. Type sudo apt update in the terminal. What this does is update internet repositories which is essential for finding and downloading the latest version of Docker.

sudo apt updatesudo apt update

  1. type sudo apt install apt-transport-https ca-certificates curl software-properties-common

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

  1. The curl command is going to let us turn our terminal into the medium that downloads the docker resource files rather than our web browser. This is both convenient for GUI users and allows you to download docker with or without a GUI.

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

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

  1. You’ll need to pay attention to this part. When we download our repository to install docker it’s going to want to attach to the version of Ubuntu we are running. Depending on the version of Ubuntu you are running the command you are going to type will be different. You will also need to know the name of your Ubuntu installation. For example, Ubuntu 19 is “Disco Dingo” and will be abbreviated in the terminal as “Disco”

Type sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable”

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable” Docker finished downloading

Installing Docker

Now that we’ve prepared the proper repositories and are prepared to download Docker from the internet using our terminal, its time to actually install docker.

  1. With all our repositories updated and downloaded, we’re all set to go, let’s just do a quick sudo apt update
  2. It’s important to make sure you set your policy to download from Docker and not any other Ubuntu repositories, for this reason, we are going to set our policy to download from docker specifically.
Type Apt-cache policy docker-ce

Apt-cache policy docker-ceapt-cache policy docker-ce

from here, you will see 3 things:

  1. Is Docker installed? (it will say none)
  2. Candidate: this is the version of Ubuntu that docker has targeted for the installation (should say your Ubuntu version) If any resources were not installed properly earlier this section will say none
  3. Version table: a list of docker versions for this particular version of Ubuntu

Docker version tableDocker sudo apt install docker-ce

\8. type sudo apt install docker-ce

sudo apt install docker-cesudo apt install docker-ce

Once that final step has been completed you should have Docker installed. A good way to find out if Docker is properly installed is to use the same apt-cache policy docker-ce command to see if this time there is a version of Docker installed.

As you can see, after typing apt-cache policy docker-ce our version of Ubuntu is listed next to installed

apt-cache policy docker-ceInstalled and candidate version match showing successful installation

Another good way to see if Docker is installed is to bring up a list of commands that you can use to control and configure Docker. If Docker is properly installed, the terminal will start to accept Docker commands.

Commands

To get a list of commands:

Type docker

docker Docker commands

Now that Docker is installed, Ubuntu will recognize Docker commands in the control panel allowing you to implement containerization and begin developing with Docker on your system.