I'm playing with Docker Swarm, trying to understand the IPv6 problem for Docker Swarm and overlay Network, when i found a strange behaviour.
netstat should show all the connections, but on a docker overlay network published port, then endpoint connection is not shown.
Work to reproduce:
- Install two Server with Docker
- Install Docker and initialize Docker Swarm
- Create an Overlay Network
Deploy nginx on the overlay network and publish port 80
docker network create --driver overlay nginx docker service create --name my-nginx --publish target=80,published=80 --network nginx --replicas=2 nginx
Then Connect from any Client to the webserver created with netcat:
nc 10.0.2.34 80
Check the netstat output on both sides:
Client:
[root@docker1 centos]# netstat -ano | grep 80
tcp 0 0 10.0.0.208:39924 10.0.2.34:80 ESTABLISHED off (0.00/0/0)
on Server:
[root@docker2 centos]# netstat -ano | grep 80
tcp6 0 0 :::80 :::* LISTEN off (0.00/0/0)
You will not see the connection that has been established by the Client. But the connection is working, I can get the main page from nginx.
Can anyone explain this?