Skip to content

Install Docker and enable IPv6 networking

Install a supported Docker Engine and test container IPv6 without replacing guest network settings.

Artikel ini belum diterjemahkan. Isi berikut berbahasa Inggris. Buka versi asli bahasa Inggris.

This tutorial is for a Linux guest administrator with sudo access, assigned IPv6 connectivity, and working console recovery. Run commands inside your guest. Docker administrator access can grant root-equivalent control of that guest. This procedure does not allocate public addresses, configure provider routing, or promise every image supports IPv6.

Install a supported Engine

  1. Identify your distribution and release with cat /etc/os-release.
  2. Check Docker’s supported releases and prerequisites for Ubuntu, Debian, or CentOS.
  3. For another distribution, use its supported Docker-compatible installation instructions. Do not assume a CentOS repository supports every derivative.
  4. Follow the selected publisher procedure, including removal of conflicting packages only after preserving existing workloads.
  5. Install the Compose plugin if you need docker compose. The legacy docker-compose package is a different command.
  6. Start and inspect the service:
sudo systemctl enable --now docker
sudo systemctl status docker --no-pager
sudo docker version
sudo docker compose version

Confirm the daemon answers before changing its network configuration. If image retrieval fails, diagnose IPv6 endpoint access separately. Do not disable TLS verification or add an unknown registry mirror.

Preserve existing daemon settings

Docker restart can interrupt containers. Arrange a maintenance window and record running workloads first. If /etc/docker/daemon.json exists, preserve a copy and merge changes rather than overwriting it. Conflicting command-line daemon options and JSON settings can prevent startup.

For a current Linux Engine, Docker supports a user-defined IPv6 network without replacing the host’s resolver or assigned addresses:

sudo docker network create --ipv6 docs-ipv6
sudo docker network inspect docs-ipv6

When no explicit IPv6 pool is configured, supported current Engines allocate a ULA subnet. A ULA is private container addressing, not an assigned public prefix or independently routable internet address. Existing default address pools can change this behavior. Inspect the network result before continuing.

Enable IPv6 on the default bridge when needed

User-defined networks and the default bridge are separate configurations. If your application specifically needs the default bridge, merge these keys into /etc/docker/daemon.json:

{
  "ipv6": true,
  "ip6tables": true
}

Current Docker can choose a ULA subnet when no fixed-cidr-v6 is specified. Do not use 2001:db8::/32 as operational addressing. It is reserved for documentation. Do not add a routed public prefix without confirming its assignment and route with your network administrator. Docker 27 and later no longer require experimental merely for IPv6 packet filtering.

  1. Validate the merged file with sudo dockerd --validate --config-file=/etc/docker/daemon.json.
  2. Resolve validation errors before restarting.
  3. Restart during the agreed maintenance window with sudo systemctl restart docker.
  4. Check sudo systemctl status docker --no-pager and sudo docker network inspect bridge.
  5. Confirm existing containers and applications still work.

If startup fails, restore the previous saved configuration and restart Docker. Inspect sudo journalctl -u docker --since '-10 minutes' locally. Redact credentials and private workload details before sharing errors. Do not disable Docker packet filtering to suppress a networking failure.

Test container connectivity

sudo docker run --rm --network docs-ipv6 alpine ip -6 addr
sudo docker run --rm --network docs-ipv6 alpine wget -qO- https://ifconfig.me

Review the image publisher and pin a version or digest for repeatable workloads. The first command checks container addressing. The second depends on DNS, image tools, guest egress, and the remote endpoint. Inspect the returned address family. A successful request alone does not prove it used IPv6. Private bridge IPv6 normally relies on the Engine’s configured masquerading and the guest’s working IPv6 route. Do not assume a ULA makes the container directly reachable from the internet.

For Compose, save a project file such as compose.yaml:

services:
  test:
    image: alpine
    command: ip -6 addr
networks:
  default:
    enable_ipv6: true

Run sudo docker compose run --rm test from that directory. Inspect the created network and confirm IPv6 addressing. This checks Compose networking, not application health.

Cleanup and troubleshooting

Remove only the tutorial’s unused network with sudo docker network rm docs-ipv6 after its containers exit. Use sudo docker compose down only in this tutorial’s project directory to remove its temporary Compose resources. Do not use volume deletion or a global prune to troubleshoot connectivity.

  • Daemon does not start: validate the merged configuration and restore the saved version if necessary.
  • Image pull fails: check registry DNS, HTTPS, and all redirected image endpoints.
  • Container has IPv6 but cannot connect: compare guest egress, container DNS, Docker filtering, and routes.
  • Published port is unreachable: check the bind address, Docker mapping, guest firewall, Panel firewall, and any provider NAT.
  • Provider route or assignment is missing: contact support with redacted errors. Docker cannot create that entitlement.

References

Ketik untuk mencari…

↑↓ navigasi↵ pilihEsc tutup