Docker Community Forums

Share and learn in the Docker community.

Bind on loopback different from

(Tjamet) #1

Expected behavior

When running docker natively on linux, it is possible to bind on any local ip within
Running docker run -p alpine tail -f /dev/null runs successfully
This is useful to have several web servers running concurrently on ‘localhost’

Actual behavior

On docker for mac, EADDRNOTAVAIL is returned:

docker: Error response from daemon: driver failed programming external connectivity on endpoint elegant_yalow (21a6bc7bfc1447056230fe83dcf8a512404585c6ef354eea5d2e1352387023bf): Error starting userland proxy: Failed to bind: EADDRNOTAVAIL.


pinata diagnose -u

OS X: version 10.11.4 (build: 15E65) 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/20160517-001725.tar.gz
Most specific failure is: No error was detected
Your unique id is: 2196A655-03A1-4E6C-B579-F5914F4F5C6C
Please quote this in all correspondence.

Steps to reproduce the behavior

docker run --rm -p alpine tail -f /dev/null

Docker Beta has conflicts when mapping same port on different IPs
(Dimitriyremerov) #2

You need to add the address to the interface first. This is not a Docker issue, but OSX specifics. You will not be able to listen on this address also with other daemons.
if you run

sudo ifconfig lo0 add netmask 0xffffffff

your command will work properly.
Docker does have an issue here however, and it’s the fact that you can’t port forward the same port from different IP addresses (which should be perfectly possible): Docker Beta has conflicts when mapping same port on different IPs