Docker Community Forums

Share and learn in the Docker community.

Docker doesn't open IPv6 ports

When I run the docker-compose.yml below it opens port 80 and 443 for the hosts IPv4 address, but it doesn’t open those ports for the hosts IPv6 address (I use nmap to scan this).

IPv6 is working fine on the host (I can use IPv6 to connect to other machines and I can connect to the host via SSH using its IPv6 address; it runs Ubuntu 20.04). I’ve run the same docker-compose.yml on other servers where the IPv6 ports did open (Ubuntu 18.04). Might there be anything on this specific server that needs to be configured for Docker to open the ports on IPv6? Am I missing something else?

version: '2.0'
services:
  nginx:
    image: nginx:1-alpine
    ports:
      - "80:80"
      - "443:443"

(I tried using docker run instead of docker-compose, but this results in the same problem.)
Docker Engine: 20.10.5
Docker-Compose: 1.25.0

2 Likes

Same for me.
On one host it correctly binds to IPv6 and IPv4, and on another it only binds to IPv4.
Hosts have a plain vanilla Debian 10 install, and docker and docker-compose have been installed from the official repositories provided by Docker; they have perfectly working dual IPv4-IPv6 stack. Same environment (basically it is working on our test machine but not in production!)

I can verify with ss -tlnp.
On one host (not working, let’s call it V):
LISTEN 0 128 0.0.0.0:3022 0.0.0.0:* users:(("docker-proxy",pid=1571,fd=4))
On the other host (correctly working, let’s call it A):
LISTEN 0 128 *:3000 *:* users:(("docker-proxy",pid=4762,fd=4))

I tried to force binding to my IPv6 in ports option, but it looks like IPv6 binding isn’t supported yet in 2021!

Everywhere online it looks like people are facing the opposite issue (eg. docker binds to IPv6 only). If only it was true! :sweat_smile:

Any help is appreciated. Thank you.

2 Likes

It seems that there is a regression in Docker regarding opening IPv6 ports since version 20.10.2. See this issue for more info. Looking further in GitHub it seems a fix is underway. Let’s hope it is fixed in 20.10.6 and that it will be released soon :slight_smile: (@giomba)

1 Like