Docker Community Forums

Share and learn in the Docker community.

Unable to bind to bridge network gateway on OSX

beta

(Marc Campbell) #1

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

(Benjamin E. Coe) #2

I’m running into this issue as well, would love to know if there are any work arounds.


(Marc Campbell) #3

With the latest Docker for OSX (Version 1.12.0-rc3-beta18 (build: 9969) 5cbabb0783b6d281b8f579cb9f4dff38373b2c10) this is still failing but the message has changed a little:

$ docker-compose up
Creating network "redis_some-network" with driver "bridge"
Creating redis_redis_1

ERROR: for redis  driver failed programming external connectivity on endpoint redis_redis_1 (66141d65ebf095cd652204232765a072ebf03a918941db857c70ecb61ac3da63): Error starting userland proxy: write /port/tcp:172.20.0.1:6379:tcp:172.20.0.102:6379/ctl: errno 526
ERROR: Encountered errors while bringing up the project.

Is there any update on a better way to run this compose file?