Version 17.03.0-ce-mac2 (15654)
on a Macbook pro with El Capitan.
I’m trying to port the development infrastructure from Vagrant+Virtualbox to Docker. To do this I need to be able to run multiple containers on my mac, each of them with its own IP address.
To be more clear, what I need, and what I already have with Vagrant is
1 - mac with its own IP, let’s say 192.168.25.55
2 - VM1 with ip (for example) 172.16.100.210, and I can curl this ip from my mac terminal or open it with a browser and have a response
3 - VM2 with ip (for example) 172.16.100.211, and I can curl this ip from my mac terminal or open it with a browser and have a response
4 - both the VMs can be reached from another mac at (for example) 192.168.25.55:8080 and 192.168.25.55:8081
I am not able to produce this result with docker having two containers in the place of the two VMs.
I already read tons of docs around, both docker’s officials and blog posts, but I still can’t understand how to do this.
Anything I obtain is among:
1 - one container with PORT 80/tcp, no IP address
2 - one container with PORT 0.0.0.0:80-> 80/tcp
in these two cases any other container need another port and get the same (or none) IP address. I can reach them via localhost. Trying to create a network and attach container to it:
3 - Error:
docker: Error response from daemon: User specified IP address is supported only when connecting to networks with user configured subnets.
4 - Error:
docker: Error response from daemon: driver failed programming external connectivity on endpoint docker-intraevo (ee20cd6cb1214a357ea94c0d562d3e8864faabeba927d975ccc27357009c6671): Error starting userland proxy: Bind for 172.16.100.200:80: unexpected error (Failure EADDRNOTAVAIL).
5 - Error
docker: Error response from daemon: driver failed programming external connectivity on endpoint docker-intraevo (b0aa6c626debf75a5abdc923f5d2ed0f4bf21f85bf27b12e161141b38dbf9161): Error starting userland proxy: listen tcp 172.16.100.200:8080: bind: cannot assign requested address.