Skip to content

Instantly share code, notes, and snippets.

@e-cite
Last active May 22, 2024 11:47
Show Gist options
  • Save e-cite/7562b08734bea84d6fc61357866f91db to your computer and use it in GitHub Desktop.
Save e-cite/7562b08734bea84d6fc61357866f91db to your computer and use it in GitHub Desktop.
Debian Docker installation tutorial

Debian Docker installation tutorial

https://docs.docker.com/engine/install/debian/

  1. Remove old docker, update and install requirements
    sudo apt-get remove docker docker-engine docker.io containerd runc
    sudo apt-get update
    sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg-agent \
        software-properties-common
    
  2. Download public-key for official docker repository and add it to system
    curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
    sudo apt-key fingerprint 0EBFCD88
    Should be: 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
    
  3. Add official docker repository
    sudo add-apt-repository \
       "deb [arch=amd64] https://download.docker.com/linux/debian \
       $(lsb_release -cs) \
       stable"
    
  4. Update again (due to the new repository) and install docker
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    
  5. Change default IP range for docker containers, since it is 172.17.0.0/16 by default :-) https://support.hyperglance.com/knowledge/changing-the-default-docker-subnet
    sudo nano /etc/docker/daemon.json
    {
    "log-driver": "journald",
    "log-opts": {
    "tag": "{{.Name}}"
    },
    "bip": "10.0.0.1/16",
    "default-address-pools":[
    {"base":"10.1.0.0/16","size":16}
    ]
    }
    
    sudo systemctl restart docker
    ip addr
    
  6. Add user to docker group to allow docker without sudo
    sudo usermod -aG docker $USER
    

Install docker-compose

⚠️ There is no deb-package for docker-compose in the official docker repository added above. So don't use apt-get install!

Install docker-compose by this tutorial: https://docs.docker.com/compose/install/

Docker beginners tutorial

https://github.com/docker/labs/blob/master/beginner/chapters/alpine.md

docker pull debian:buster
docker images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment