Installing Docker

Docker Toolbox is outdated and I won’t describe it in this article, but it used to be the only option for Windows 7/8 users in the past. It includes Docker Client, Docker Compose, Docker Kitematic which is a graphical UI to manage containers and images and Docker Machine that will spin up a boot2docker image inside of VirtualBox. These are Linux containers running with a Linux kernel inside the VM.

Docker on Windows

Docker Desktop provides image and container tools. You need either Windows 10 Pro+, Mac or you can install Docker Desktop on Windows Home using the WSL 2 backend. It uses Hyper-V/Hyperkit to run VMs. Works on Windows, Max, Linux (via Docker Engine). Not meant for production, only for development. You get Docker Client, Docker Compose and Docker Kitematic optionally.

Windows Server Containers run Windows binaries on the same host OS, similar to how Linux containers on a Linux OS do not need a VM.

Docker on Ubuntu 20.04

First you have to add the repository once and verify the fingerprint:

$ sudo apt-get update

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

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

$ sudo apt-key fingerprint 0EBFCD88

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

Next, you install the latest docker engine:

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

docker run hello-world

You might get the following error when running docker run hello-world:

docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

Do the following to fix it, so that you can use the docker command without sudo:

sudo groupadd docker
sudo usermod -aG docker ${USER}

Now log out and back in and enter docker run hello-world. If the error still occurs do this:

sudo systemctl restart docker
sudo chmod 666 /var/run/docker.sock

About Author

Mathias Bothe To my job profile

I am Mathias from Heidelberg, Germany. I am a passionate IT freelancer with 15+ years experience in programming, especially in developing web based applications for companies that range from small startups to the big players out there. I create Bosycom and initiated several software projects.