Installing Docker for Ubuntu 16.04 (Xenial)

Docker for Ubuntu.

In this guide I will show you guys what you need to do to get Docker installed properly in you Linux machine, this guide is oriented to Ubuntu 16.04 (Xenial) which is at the date one of the Ubuntu versions which allow Docker to be installed. let’s get started!.

In the case you don’t know what Docker is and what it is used for, I encourage you to check out my post explaining What’s the matter with Docker?, that said, let’s start the guide!.

Note: Docker is supported by the following architectures:

  1. x86_64 (or amd64).
  2. armhf.
  3. arm64.
  4. s390x (IBM Z).
  5. ppc64le (IBM Power.

First of all, let’s update apt-get by writing the following command on the command line:

$ sudo apt-get update

Now we need to install some packages in order to allow apt to use a repository over HTTPS by writing:

$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Let’s add Docker’s GPG key to validate the identity on the repository by writing:

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

Now depending on the architecture you are using the following command changes, keep an eye on that:

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

2. armhf

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

3. arm64

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

4. ppc64le (Note: when I wrote this code, I noticed a possible misspelling from the Docker’s team but I was not able to test it because I don’t use that architecture, so if you’re getting error with the first code, try the second one):

$ sudo add-apt-repository \
"deb [arch=ppc64el] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
(if the first one don't work try this)$ sudo add-apt-repository \
"deb [arch=ppc64le] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

5. s390x

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

Let’s update apt with:

$ sudo apt-get update 

Install the latest version of Docker and Containerd:

$ sudo apt-get install docker-ce docker-ce-cli containerd.io 

Now verify Docker is correctly installed by writing:

$ sudo docker run hello-world 

All information of this guide can be found on Docker’s documentation, here you will be able to find guides into more advanced topics.

Congratulations! now you have Docker properly installed on your Ubuntu machine, this, is the very beginning of your process to simplify the development of your apps, I hope you can find in this tool the way to improve your developing experience, Be creative, be graphical, have fun, and keep coding! see you soon!.

--

--