I've been using virtual machines (via VirtualBox) for Linux-based testing and development for sometime but I've been persuaded that it's high-time I joined everyone else and started using containerisation.

I started by looking into whether Docker or Singularity would be best for me. After much reading and talking to colleagues I concluded that Singularity would be much better however it is undergoing rapid development (very frequent releases, often with significant security fixes) and Docker has a larger community and eco-system around it at the moment.


Right, on to getting this thing working. First thing to do is install the Community Edition of Docker. For Debian this means adding the Docker repositories and several dependencies are mentioned on the relevant documentation page. First thing is to check if those dependencies are already installed:

$ for dep in apt-transport-https ca-certificates curl gnupg2 software-properties-common; do dpkg -s $dep &>/dev/null || echo "$dep NOT INSTALLED"; done

If any are missing, install them:

$ apt-get install gnupg2

Add the repository, I created it in /etc/apt/sources.list.d/docker.list:

deb https://download.docker.com/linux/debian stretch stable

Next I installed Docker:

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

I opted not to add my user to the docker group for this reason (from the install documentation):

The docker group grants privileges equivalent to the root user.
I have sudo setup to require a second factor, adding the user I normally use to the docker group would completely defeat the purpose of protecting root access with more than just my own password.

Finally, I tested docker was up and running with the hello-world container:

$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8
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 ID:

For more examples and ideas, visit:

I do need to write a follow up post on creating my first containers with it, now it's installed.