Install Docker and Docker-compose on debian system

Created on 2023/12/31website-design-development • 190 views • 1 minutes read

Install Docker and Docker-compose on debian system

Install Docker, Docker-compose

Update and install necessary software

apt-get update && apt-get install -y wget vim

Install Docker

wget -qO- | bash

Note: If sudo: unable to resolve host [hostname] appears, you can edit vi /etc/hosts and then leave a blank space after localhost and type [hostname] with your corresponding hostname content.

View Docker version

docker -v

Automatically start at boot

systemctl enable docker

Uninstall Docker (not required)

sudo apt-get purge docker-ce docker-ce-cli

sudo rm -rf /var/lib/docker

sudo rm -rf /var/lib/containerd

Install Docker-compose

sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

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

docker-compose --version

Modify Docker configuration

The following configuration will add a custom intranet IPv6 address, enable the IPv6 function of the container, and limit the log file size to prevent Docker logs from filling up the hard disk:

cat > /etc/docker/daemon.json <


  "log-driver": "json-file",

  "log-opts": {

    "max-size": "20m",

    "max-file": "3"


  "ipv6": true,

  "fixed-cidr-v6": "fd00:dead:beef:c0::/80",





Restart the Docker service:

systemctl restart docker