How to install and setup Debian 8 minimalist Docker Host

Author:Tobin Harding
Task is to configure x86 bare metal machine as a docker host using
Debian 8. You will need a network connection to the host to follow
this guide. Also a connected keyboard and monitor.

Prerequisites

  1. Host machine. I will be using an optiplex 760 but any machine will
    do.
  2. Internet connection. I will be using the net install Debian 8
    image.
  3. About half an hour.

Step One: Prepare Boot-able USB

Download the debian 8 amd64 net install image from your favourite
mirror. As for an example:
http://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-VERSION-amd64-netinst.iso.

Download the check sums. We will be using SHA512SUMS, this file will
be in the same directory as the above image.

$ sha512sum --check SHA512SUMS 2> /dev/null | grep 'netinst'
debian-8.0.0-arm64-netinst.iso: OK

The above command runs sha512sum and checks against the file we
downloaded. We redirect stderr to /dev/null so we don’t see error
messages. Then we used grep to only see the result from the image we
downloaded.

Now for the boot disk, we check our current device list

$ ls /dev/sd*
OR
# fdisk -l

Insert a USB stick and re-run the above command. The new entry is the
device you just plugged in. We then write the downloaded image to this
device with the ddrescue command. In this example we will
use /dev/sdX

$ ddrescue --force /path/to/debian-8.0.0-amd64-netinst.iso /dev/sdX

Did you use the right drive letter? Did you? If not, you’ll be
crying, right about now….
– Knoppix Wiki

Step Two: System Installation

We can now insert the newly created USB device into our target machine
and reboot.

Assuming that you have been able to boot from the USB you will
now be faced with the debian installer. Select Advanced
Options
and then Expert Installer.

IMPORTANT:
From here on select and complete all menu items
except for Select and Install Software. Do not select
this step if you wish to install a minimal server setup.

You will have configured /etc/apt/source.list during the
install process, if you like take a look and make sure it is as
required. Then we will update the system and install basic software
required to interact with the server.

# apt-get update
# apt-get upgrade
# apt-get -y less vim openssh-server curl

Let’s reboot the machine. Now you can ssh into the newly setup host
from your usual workstation. Note, by default root login with password
is disabled
. You may want to configure ssh, this is done by
editing the ssh deamon configuration file
/etc/ssh/sshd_config See above link for how to change this
behaviour. If you are lazy, like myself, and used a non-secure root password
during setup now is the time to generate a secure one and store it in
your favourite password manager (updating the server also of
course). If you do not have a favourite password manager, may I suggest Pass – The Standard Unix Password Manager.

Step Three: Docker installation

You now have a bare bones Debian 8 server instance. You can then install docker

# apt-get install docker.io

But this may give you an error message:

Package 'docker.io' has no installation candidate

Following the solution for Package ‘docker.io’ has no installation candidate error message, we have finally come to the actual docker installation. The installation of docker on Debian Jessie is simple as:

# curl -sSL https://get.docker.com/ | sh

All done. If required, using your newly installed docker you can now also install your own private docker registry.