Getting started with docker: Installation

Before beginning our internship at Small Town Heroes, we didn’t have any experience with Docker.
Since Rome wasn’t built in a day, we would learn this technology step-by-step, starting with the basics.

1. Setting up Docker on Fedora 23

The first step in this process was to setup Docker locally on our machine.
In our case this was our laptop with Fedora 23 as OS.
Basically we needed two parts, the docker engine and the docker machine.

Docker engine:

The docker engine is a client-server application consisting of three elements:

  1. The docker daemon
  2. a REST API
  3. and a CLI that talks to the daemon through the REST API

We installed this very easily by using the dnf package manager. For all of these steps, it’s important to be logged in with sudo priviliges.

1. Make sure all of your packages are up-to-date

$ sudo dnf update


2. Add the yum repo

$ sudo tee /etc/yum.repos.d/docker.repo <<-‘EOF’ 
[dockerrepo] 
name=Docker Repository 
baseurl=https://yum.dockerproject.org/repo/main/fedora/$releasever/ 
enabled=1 
gpgcheck=1 
gpgkey=https://yum.dockerproject.org/gpg 
EOF


3. Install the Docker package

$ sudo dnf install docker-engine


4. Start the Docker daemon

$ sudo systemctl start docker


If this works without resulting in any errors, then you’re most likely good to go. But to make sure you can always verify your installation by deploying a test image in a container.

Docker machine:

“Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands.”

With docker machine, it’s possible to deploy multiple hosts, each running a docker engine, a.k.a. Dockerized hosts or Machines. Each of these hosts can contain multiple containers that are created from an image. The benefit of using docker machine on Linux is to efficiently provision multiple Docker hosts on a network, in the cloud or even locally.

Now back to installing this…

1. Download Docker machine and extract it

$ curl -L https://github.com/docker/machine/releases/download/v0.6.0/docker-machine-`uname -s``uname -m` > /usr/local/bin/docker-machine && \ chmod +x /usr/local/bin/docker-machine


2. Verify your installation by checking the version

$ docker-machine version
docker-machine version 0.6.0, build 61388e9


After this was all done, we were ready to start creating our own docker machine to deploy containers.