What is the replacement for `--net=container` in new docker networking?

时间:2016-10-09 15:51:03

标签: networking docker

In the pre docker 1.9 days I used to have a vpn provider container which I could use as the network gateway for my other containers by passing the option --net=container:[container-name].

This was very simple but had a major limitation in that the provider container had to exist prior to starting the consumers and it could not be restarted.

The new docker networking stack seems to have dropped this provision in favour of creating networks which does sound better, but I'm struggling to get equivalent behaviour.

Right now I have created an internal network docker network create isolated --internal --subnet=172.32.0.0/16 and brought up 2 containers one of which is attached only to internal network and one which is attached to both the default bridge and the internal network.

Now I need to route all network traffic from the isolated container through the connected one. I've messed around with some iptable rules but tbh this is not my strongest area.

So my questions are simply: Is my approach along the right lines? What rules need to be in place in the two containers to get this working as --net=container?

0 个答案:

没有答案