Introduction

Docker and docker-compose are a very common tools for developing and deploying applications.

In this post I will cover the process of installing Docker engine and Docker compose on Debian 10 minimal.

Software Versions Used In This Post

  • Debian Minimal - 10.7 Buster
  • Docker Engine CE - 19.03.14
  • Docker Compose - 1.27.4

Pre-Flight Check

Ensure that there are no default versions of Docker install. There should not be, but it's worth confirming.

cmd

apt list --installed | egrep "(docker|container)"
    

Docker Install

Add the required APT repositories.

cmd

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

Add the GPG key.

cmd

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

Verify the GPG key matches the key listed in the docks.

cmd

sudo apt-key fingerprint 0EBFCD88

# Output
pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) 
sub   4096R/F273FCD8 2017-02-22
    

Add the required APT repositories.

cmd

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

Install Docker, the CLI tools and containerd.

cmd

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

Confirm the docker service is started and enabled.

cmd

systemctl enable docker

# Output 
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-12-12 06:07:54 AEST; 6min ago
     Docs: https://docs.docker.com
 Main PID: 4750 (dockerd)
    Tasks: 10
   Memory: 48.1M
   CGroup: /system.slice/docker.service
           └─4750 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
    

Add your user to docker group.

cmd

sudo usermod -aG docker $USER
    

Now logout and log back in or run the newgrp docker command.

Verify Docker Install

Confirm that you can run docker commands.

cmd

docker pull hello-world

# Output
Using default tag: latest
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:e7c70bb24b462baa86c102610182e3efcb12a04854e8c582838d92970a09f323
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest
    

Docker Compose Install

Install the docker-compose binary from the Github release page.

cmd

sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    

Make the docker-compose binary executable.

cmd

sudo chmod +x /usr/local/bin/docker-compose
    

Symlink the docker-compose binary into a location in your $PATH.

cmd

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
    

Update the docker-compose binaries permissions.

cmd

sudo chgrp docker /usr/local/bin/docker-compose
sudo chmod 750 /usr/local/bin/docker-compose
    

Verify Docker Compose Install

Confirm that you can run docker-compose commands.

cmd

docker-compose --version

# Output
docker-compose version 1.27.4, build 40524192
    

Summary

This post covered the process of installing Docker engine and Docker compose on Debian 10 Minimal.

docker debian