Before you start: KVM, not LXC
Docker needs Linux kernel features that are restricted inside an LXC container. Choose a KVM VPS, which has its own kernel (see KVM or LXC). The VPS Mini is enough for one or two small containers; from three or four services, or with a database, take the VPS Start or the VPS Plus.
What breaks without configuration
Two things cause problems on an IPv6-only VPS:
- Downloads. Some services have no IPv6, such as Docker's installation repository or the ghcr.io registry. Docker Hub, on the other hand, offers an IPv6 endpoint.
- The containers themselves. Docker's default network only has IPv4. A container that wants to reach an API, send an email or download an update finds no route.
Start by setting up a NAT64/DNS64 service on the VPS, as explained in the GitHub over IPv6 guide. It solves the first point, and will also benefit the containers, which inherit the machine's DNS servers.
1. Install Docker
Once NAT64 is in place, Docker's official script works. Read it before running it, like any downloaded script:
curl -fsSL https://get.docker.com -o get-docker.sh
less get-docker.sh
sh get-docker.sh
docker --version
docker compose version
2. Enable IPv6 in Docker
Create or edit the file /etc/docker/daemon.json:
{
"ipv6": true,
"fixed-cidr-v6": "fd00:d0c:1::/64"
}
fd00:d0c:1::/64 is a private IPv6 network (a ULA address, the equivalent of IPv4's 192.168.x.x). Your containers get an address in it, and Docker translates their outgoing traffic to the VPS's public address, exactly as it does with IPv4. This is necessary because your VPS only has a single public IPv6 address (/128): it is impossible to give one to each container. Restart Docker:
systemctl restart docker
3. Check from a container
docker run --rm alpine ping -6 -c 3 ipv6.google.com
docker run --rm alpine wget -qO- https://api64.ipify.org
The first command should receive replies, the second should print your VPS's IPv6 address: the container is reaching the Internet through your address. If the alpine image does not download, check NAT64, or use Docker Hub's IPv6 endpoint directly:
docker pull registry.ipv6.docker.com/library/alpine:latest
4. Docker Compose: enable IPv6 on each network
The daemon.json setting only applies to the default network. Compose creates one network per project, which stays IPv4-only unless you say otherwise. Add a network with enable_ipv6:
services:
web:
image: nginx:alpine
ports:
- "8080:80"
networks:
- app
networks:
app:
enable_ipv6: true
If no subnet is specified, Docker picks a private IPv6 network in fd… by itself. Start with docker compose up -d.
5. Publish a port over IPv6
A port published with -p 8080:80 or in the ports section listens on all of the machine's addresses, IPv6 included. Test from your computer:
curl -6 http://[2001:db8::10]:8080
Replace the address with your VPS's. For a site to also be visible to visitors on IPv4, put it behind Cloudflare as explained in the IPv6 VPS guide.
"[::1]:8080:80".