Connection refused when binding on specific network interface
- [x] I have tried with the latest version of my channel (Stable or Edge)
- [x] I have uploaded Diagnostics
- Diagnostics ID: A9ED9B97-D92A-4CA1-8ED2-0E00668E6E03/20200607171551
Expected behavior
Here a docker compose file with 2 services and one network
version: '3.1'
services:
service1:
image: alpine/socat
command: TCP-LISTEN:9999,bind=127.16.1.10 SYSTEM:"echo lol"
networks:
network1:
ipv4_address: 172.16.1.10
service2:
image: alpine/socat
entrypoint: ''
command: sh -c 'sleep 2 && ping -c 1 172.16.1.10 && socat - TCP4:172.16.1.10:9999'
depends_on:
- service1
networks:
- network1
networks:
network1:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.1.0/24
service1 is a socat binding on specific interface, 127.16.1.10:9999 should be reachable from service2
Actual behavior
But it's not.
$ docker-compose run service2
Creating network "docker_network1" with driver "bridge"
Creating docker_service1_1 ... done
PING 172.16.1.10 (172.16.1.10): 56 data bytes
64 bytes from 172.16.1.10: seq=0 ttl=64 time=0.197 ms
--- 172.16.1.10 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.197/0.197/0.197 ms
2020/06/07 16:06:15 socat[1] E connect(5, AF=2 172.16.1.10:9999, 16): Connection refused
Information
- macOS Version: 2.3.0.3 (45818) I tested on docker 19.03.7 on Linux and the issue is not reproducible. Binding on 0.0.0.0 works nonetheless.
Steps to reproduce the behavior
Run the docker-compose file upper.
Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked