Cannot bind to specific IPs: cannot assign requested address.
- [x] I have tried with the latest version of my channel (Stable or Edge)
- [x] I have uploaded Diagnostics
- Diagnostics ID:
D101B22D-FABF-4C6B-A4D9-07BA9A23270D/20200121200047
Expected behavior
I should be able to bind to any IP on my mac.
Actual behavior
Trying to bind explicitly to my mac's wifi address results in an error: 192.168.2.2:443: bind: cannot assign requested address.
Binding to 127.0.0.1 or 0.0.0.0 explicitly does work, any other IP does not work.
Information
- macOS Version:
10.15.2 (19C57) - Docker for Mac: 2.2.0.0 (42247)
Steps to reproduce the behavior
- Use
ifconfigto find your wifi or lan IP. - Run
docker run -p 192.168.2.2:443:443 nginx - Receive this error:
docker: Error response from daemon: driver failed programming external connectivity on endpoint elated_austin (f94e21669eb9ad9b6cc3d9cc4effd5beb78617d558c0213c2a3c72da10fbfbb0): Error starting userland proxy: listen tcp 192.168.2.2:443: bind: cannot assign requested address.
This error only started when upgrading to 2.2.0.0. Downgrading to 2.1.0.4 and the problem goes away.
I'll confirm this. It seems that binding to an IP directly fails.
Binding to 127.0.0.1 directly does work though, so its odd.
I am also affected by this error. I was using an alias to bind the ports, so that it wouldn't conflict with other services running on the same ports.
To create an alias I use:
sudo ifconfig lo0 alias 10.10.10.10
And this docker-compose.yml used to work:
version: '3.7'
services:
nginx:
image: nginx:latest
ports:
- 10.10.10.10:80:80
I was using an alias to bind the ports, so that it wouldn't conflict with other services running on the same ports.
Same motivation and confirming the same issue on 2.2.0.0.
This seems to be a recurring problem. Previous reports: https://github.com/docker/for-mac/issues/4032, https://github.com/docker/for-mac/issues/3970
Downgrading to v2.1.0 solves the issue for me: https://download.docker.com/mac/stable/40693/Docker.dmg
Confirmed this issue applies to both Mac and Windows Docker Desktop versions.
Downgrading to the latest 2.1.x version (2.1.0.5) solves the problem. Here are the direct download links:
- Mac: https://download.docker.com/mac/stable/40693/Docker.dmg
- Windows: https://download.docker.com/win/stable/40693/Docker%20Desktop%20Installer.exe
I hit this today as well. Downgrade I go...
Any status on a fix for this issue?
I've downgraded, which resolves it, following.
Here is the issue on the Windows side: https://github.com/docker/for-win/issues/5546
Also experiencing this issue on Docker for Mac: 2.2.0.3
I also hit this. My specific IP in question is bound to lo0 interface on Mac.
so will this be fixed soon?
Interestingly it does work when the IP you're attempting to bind to is added to the lo interface inside the docker virtual machine as well:
docker run -it --rm --privileged --pid=host justincormack/nsenter1
ip addr add 10.10.10.10/32 dev lo
Then add it locally (on MacOS):
sudo ifconfig lo0 alias 10.10.10.10/32
And run some service on it:
docker run -p 10.10.10.10:80:80 nginx
10.10.10.10:80 is then properly forwarded to the container. This does, however, break connectivity from containers to that specific IP.
Also experiencing this issue on Docker for Mac: 2.2.0.4
@friek alias is not working for me!
I can confirm I am experiencing the same issue with 2.2.0.4 on Mojave 10.14.6: unable to bind to a port when specifying an IP address.
I use this because I want a container only to be listening on a specific VLAN on my machine.
With 2.1.0.5 all is working as expected, so I too reverted to that version.
Tried 2.2.0.4 again on my local. The new GUI features promised were too tempting not to try again. Bummed like everyone else0. Sadly returning to 2.1.0.5.
$ fin project start
ALERT: Some Docksal services were not running
Restarting Docksal system services...
Configuring network settings...
Configuring NFS shares...
NFS shares are already configured
Resetting Docksal system services...
* proxy
docker: Error response from daemon: driver failed programming external connectivity on endpoint docksal-vhost-proxy (9443bb5547db8ef71b9fa8a29fb74483f0ce754a4e1941f21418c72e1dc7de22): Error starting userland proxy: listen tcp 192.168.64.100:443: bind: cannot assign requested address.
ERROR: Failed starting the proxy service.
You know what would be great? If we could get any indication at all from the Docker team that they consider this issue a priority. This has evidently broken Docker completely for a lot of people.
It sure did, we're starting to look for alternatives for our workflow since we'll have to change it, might as well see what's out there... Multirun seems instersting too.