Shurn the Awesomer
Tutorial: Docker installation on Ubuntu 16.04

Tutorial: Docker installation on Ubuntu 16.04

Written on Fri, 26 August 2016

First time Docker user here. So far with whatever I've read, it seems it's a very useful tool to use. Especially if there is a need to run multiple applications in an environment. That way, I shouldn't need to worry about conflicts between applications. So far, my way of isolating applications is by using Virtual Machines, running independent OS. It's not too efficient, but it works. Maintanence is quite a hassle, but I'm quite used to it. I'm going to give Docker a try and see how it will benefit me.

Here's a tutorial on how I installed Docker on Ubuntu 16.04.

Preparing Ubuntu


All commands are running on root. If you're not running on root, be sure to add sudo to every command.
I'm assuming that you are working on a fresh copy of ubuntu 64bit installation. It's a good practise to ensure that you update all your apps before proceeding.

apt-get update
apt-get dist-upgrade

Installing Docker


This part of the tutorial is taken directly off their documentation.

We need to add their repository to get the latest docker stuff.

apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Now we add their source.

nano /etc/apt/sources.list.d/docker.list


If there is any thing written in it, remove all of it. I doubt there is any, as it's a new ubuntu installation. Then add the following line and save:

deb https://apt.dockerproject.org/repo ubuntu-xenial main

Time to get the docker application.

apt-get update
apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
apt-get install docker-engine
service docker start

Let's give the docker a try and see if it works:

docker run hello-world

You should get something like the following:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
https://hub.docker.com

For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

Congratulations. Have fun and tell me about your experience.