Skip to content
Client Panel

Install Docker and Enable IPv6 network

This document provides a comprehensive guide for installing Docker and enabling IPv6 networking on a cloud environment platform. It covers the installation process for systems using apt (Debian, Ubuntu) and dnf (CentOS, Rocky Linux, Alma Linux) package managers. By following these steps, you will be able to set up Docker for containerized application deployment and configure it to support IPv6 networking, ensuring compatibility and scalability for modern network environments.

Terminal window
sudo apt update
Terminal window
sudo apt -y install docker.io docker-compose
Terminal window
sudo systemctl enable docker
Terminal window
sudo systemctl start docker
Terminal window
sudo systemctl status docker

we are going to use the reserved range of IPv6.

  • 2001:0db8:0000:0001:1000::/68 as the default network range.
  • 2001:0db8:0000:0001:2000::/68 as a default address pool. New networks should use /80 ranges. A /68 range contains 4096 /80 subnets.
Terminal window
cat <<EOF | sudo tee /etc/docker/daemon.json >/dev/null
{
"ipv6": true,
"fixed-cidr-v6": "2001:0db8:0000:0001:1000::/68",
"experimental": true,
"ip6tables": true,
"default-address-pools":[
{"base": "172.31.0.0/16", "size": 24},
{"base": "2001:0db8:0000:0001:2000::/68", "size": 80}
],
"dns": ["2a00:1098:2c::1", "2a01:4f9:c010:3f02::1", "2a00:1098:2b::1"]
}
EOF
sudo systemctl restart docker
Terminal window
docker run --rm alpine wget -qO - https://ifconfig.me && echo ""

it should be show your public IPv6 address

Make a docker-compose.yaml

services:
test:
image: alpine
command: /bin/sh -c "wget -qO - https://ifconfig.me && echo ''"
networks:
default:
enable_ipv6: true

and execute this. It should generates an /80 network. Docker compose creates a default network for each docker compose file.

Terminal window
docker compose run --rm test