Expected behavior
I should be able to bind a service to the gateway address of a virtual network. This works on docker-engine in Linux, but not on OSX.
Actual behavior
When binding to a gateway address, docker-compose up
returns the error Unix.Unix_error(Unix.EADDRNOTAVAIL, "bind", "")
.
Information
I can bind any service to 0.0.0.0, but when I try to bind to the more restrictive network, Docker errors with Unix.EDDRNOTAVAIL.
Steps to reproduce the behavior
Using the following simple docker-compose yml on OSX will reproduce this:
version: '2'
networks:
some-network:
driver: bridge
driver_opts:
com.docker.network.bridge.host_binding_ipv4: "172.20.0.1"
ipam:
driver: default
config:
- subnet: 172.20.0.0/16
gateway: 172.20.0.1
services:
redis:
image: redis:3
ports:
- 6379:6379
restart: on-failure
networks:
some-network:
ipv4_address: 172.20.0.102
$ docker-compose up
Removing compose_redis_1
Recreating 35d480738587_compose_redis_1
ERROR: for redis driver failed programming external connectivity on endpoint compose_redis_1 (185031fd698ef0172bd7f62f560ec2a495869bf1baac9e6b104a9e26e003fa85): Error starting userland proxy: Failed to bind SOCK_STREAM 172.20.0.1:6379 Unix.Unix_error(Unix.EADDRNOTAVAIL, "bind", "")
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "compose/cli/main.py", line 63, in main
AttributeError: 'ProjectError' object has no attribute 'msg'
docker-compose returned -1