Bind: cannot assign requested address

Expected behavior

A container port gets bound to the specified ip:port . I should be able to specified any available ip adress on my interfaces, e.g. ip of my local network connection, or an arbitrary alias created for the loopback interface.

Actual behavior

An error is displayed: Error starting userland proxy: listen tcp 192.168.0.3: 11212: bind: cannot assign requested address.

Information

pinata diagnose -u on OSX

OS X: version 10.10.5 (build: 14F1713)
Docker.app: version v1.11.1-beta11
Running diagnostic tests:
[OK]      docker-cli
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160514-015736.tar.gz
Most specific failure is: No error was detected
Your unique id is: F1CC9C62-2E2B-4229-A554-BC996E1558E0

Steps to reproduce the behavior

  1. docker run -p 127.0.0.1:11212:11211 --cap-add NET_BIND_SERVICE memcached
    This works well

  2. docker run -p 192.168.0.3:11212:11211 --cap-add NET_BIND_SERVICE memcached
    Error is triggered:

docker: Error response from daemon: driver failed programming external connectivity on endpoint small_brattain (9775d50ef04f0006c406013ddd1f245984565fe949da8c41494b617f9cb58329): Error starting userland proxy: listen tcp 192.168.0.3:11212: bind: cannot assign requested address.

The specified ip (192.168.0.3) is actually assigned to my interface:

-> ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether 3c:15:c2:c9:e7:2a
	inet6 fe80::3e15:c2ff:fec9:e72a%en0 prefixlen 64 scopeid 0x4
	inet 192.168.0.3 netmask 0xffffff00 broadcast 192.168.0.255
	nd6 options=1<PERFORMNUD>
	media: autoselect
	status: active
4 Likes

any updates on this. I’m having the same problem.

Same problem here. As long as I do not specify any IP to bind the port it runs fne. But if a specific IP is given it can not assign the requested address even if ‘ifconfig’ shows that the interface with this IP is up and ‘netstat’ shows the port is not in use. Docker version: 1.12.0-beta21 (build: 11019)

Looks like it’s even sort of documented: Explore networking features on Docker Desktop | Docker Docs

Docker for Mac will make the container port available at localhost.

Are there any plans to support binding to interfaces other than 127.0.0.1?

I have this same problem. I am unable to bind containers to a specific IP address which is quite problematic as I need to expose containers running with the same exposed ports.

I have the exact same issue with the latest Docker for Mac beta-release.

I had an ip alias for my lo0 interface that I could usually bind to, but I can no longer do that.

I have the same problem
I am using docker for windows
Docker version 19.03.5, build 633a0ea

I have this same problem. I am unable to bind three containers at the same image Oracle-10g to a specific IP address of each container.