Issue type: Can’t start container with desired networking. Before I continue endlessly trouble-shooting, I’m hoping someone might just see the problem. I will happily accept referral to the appropriate docs (I have tried to find them). If it shouldn’t have ever worked, please help me see how to do something equivalent.
I want to be able to have only the container assigned to a certain IP address and port combination.
OS Version/build: Debian 8.5 and Ubuntu 14.04.5, at least
Docker versions: 1.11.2, build b9f10c9 & 1.12.3, build 6b644ec
App version: Complicated homemade thing, but can reproduce on others. See below.
Steps to reproduce: Try to use “-p 192.168.x.y:Z:Z” in a docker run command. I’m not sure how to make it always work or not work.
Expected behavior that I got to work at least once: queries to port Z at IP address 192.168.x.y are sent to the container.
Sometimes it works:
For example here: http://dev.glycam.org
- The docker version is 1.11.2, build b9f10c9
- The host is Debian 8.5
- I don’t think the host machine has any other relationship to the ip address, as in:
** There is no host interface, real virtual or other, with the address 192.168.x.y.
** Neither is the address listed in our internal DNS. - Our router does NAT the external address to that one. Could this somehow be the difference?
- Attempts to start other images in analogous manners on the same host give errors as detailed below.
** For example, I can’t get this to work at all:docker run -dit --name my-apache-app -p 192.168.x.y:80:80 -v "$PWD/htdocs/":/usr/local/apache2/htdocs/ httpd:2.4
Here’s how I start the container for the site above:
docker run \ -d -P \ -p 192.168.x.y:80:80 \ --net=DOCKER_NETWORK \ --name NET_NAME \ --net-alias NET_ALIAS \ -v $(pwd)/directory1:/path1/in/container \ -v $(pwd)/directory2:/path2/in/container \ -v $(pwd)/directory3:/path3/in/container \ image_name:image_tag
I stopped and restarted that container tonight to prove that the command still works.
Is there some way to figure out what I did right in this case that I’m not doing in others?
Mostly, it doesn’t work:
I think I’m doing things the same, so there must be something subtle that I’m not seeing. When it doesn’t work, the response is always something like:
docker: Error response from daemon: driver failed programming external connectivity on endpoint my-apache-app (longhash): Error starting userland proxy: listen tcp 192.168.x.y:80: bind: cannot assign requested address.
I haven’t yet duplicated exactly the website (above, that works) elsewhere. Doing that isn’t as simple as you might think. But, I can. Probably.
This has been addressed before. See forum links below. I’ve also found discussion on GitHub. But, I can’t find any resolutions that explain the issue or fix the problem for me. Some of the posts below are under “for mac” or “for windows”, but I’m not convinced that it is an OS thing.