IP Routing to container

Hi,

I created a new docker network like this:

docker network create --subnet 203.0.113.0/24 --gateway 203.0.113.254 iptastic

Then started a new container and assigned it to the new network with a fixed IP address like this:

docker run --net iptastic --ip 203.0.113.2 -d -P --name test_sshd eg_sshd

With regards to IP routing to the new container from my Mac OS, what interface is used by Docker for Mac for this ?

3 Likes

So adding to this question. This is my Docker network which shows a container attached with an IP address of 203.0.113.2. I can see in ifconfig an interface called bridge100 which has an ip address of 192.168.64.1.

Thus I would have expected that adding the following route:

route -n add 203.0.113.0/24 192.168.64.1 would allow me to connect to the containers IP address from my Mac. However that does not work. Am I missing something here ?

If I run Docker in virtualbox and do the same and add a route from my mac to the virtualbox interface it works.

[
{
“Name”: “iptastic”,
“Id”: “4419b3ebf7fe8539c2338a57acc1dec562500f06c8e144c9f77d00d26e228bec”,
“Scope”: “local”,
“Driver”: “bridge”,
“EnableIPv6”: false,
“IPAM”: {
“Driver”: “default”,
“Options”: {},
“Config”: [
{
“Subnet”: “203.0.113.0/24”,
“Gateway”: “203.0.113.254”
}
]
},
“Internal”: false,
“Containers”: {
“cc940a202eac3262b80308c3d793cc3007fdc0bd5b0c9570826aade2099ebe0e”: {
“Name”: “test_sshd”,
“EndpointID”: “cce8af1e05b75c47aeece32ae5cb0dc88700c7fcb89ed3cfcfdc4a1101ab0fb7”,
“MacAddress”: “02:42:cb:00:71:02”,
“IPv4Address”: “203.0.113.2/24”,
“IPv6Address”: “”
}
},
“Options”: {},
“Labels”: {}
}
]

same issue here, with the default bridge network

OK I did some more research and replicated each of the steps from my Mac on a Linux (Ubuntu) platform. Everything worked fine, I didn’t even need to add any routes and could connect to the docker container IP’s straight away. I then added a static route from my mac to the IP address of the Linux platform which then enabled me to connect from my Mac to the containers running on Linux.

So I guess there are still issues with networking on the Mac.

1 Like

Yes we are aware of this (internal issue #2216).By default the bridge will not accept routes over it. Will update when we have decided how to resolve this.

1 Like

I ran into this too, our current development environment is counting on being able to route to 172.16.0.0/12 from OSX.

Also having this issue and would definitely appreciate if it would be solved so that developing with Docker would be consistent on any platform including OS X. Keep up the good work!

+1 This feature would be much appreciated.

+1 This feature would be much appreciated.

Where can I find/track internal issue #2216 ?

I don’t know if there is a public issue for internal issue 2216, but I filed a similar enhancement request on github:

I don’t know when/if Docker for Mac will give Mac processes direct access to containers by ip.

Until then I might switch back to docker-machine / VirtualBox. Hopefully “route” still works with docker 1.12 networking and swarm.

+1 This feature would be much appreciated.

+1 for this networking “feature”.

It appears that Docker knows about this issue: see “Known Limitations” at https://docs.docker.com/docker-for-mac/networking/

What I would like to understand is Docker’s strategy for this issue and some feedback on this channel so we can understand what to expect from Docker.

+1 This feature would be much appreciated.

This is the same as the following topic

For those who haven’t yet got a working solution for this, I have created a shim workaround for this issue in this project. It behaves the exact same as the hvint0 interface on Windows

More details can be found here:

Honestly the fact this issue hasn’t been fixed is ridiculous so I plan to make some waves with this package. Request to update docs here:
docker/docker.github.io#3922

Please upvote and comment your support so that this issue gets the attention it deserves

1 Like