WARNING: HACKS AHEAD!
Networking (today) is a little awkward inside of Docker so we need to compensate for a lot of the assumptions made on the users behalf. To do this you need to create a bridge interface for the interfaces to actually sit on and then pass the configuration via
--lxc-conf options in a fashion similar to this answer.
As an example (Caveats, this will likely not directly be copy/pastable. I'm regurgitating this from memory):
First we configure a sub interface on
eth0 which is on VLAN800:
Next we create a bridge for other devices which will need to access that VLAN:
Then we attach that subinterface previously created to the bridge:
Now we are in a state where we have the network we want configured on the host and can do something like:
docker run \
--lxc-conf="lxc.network.type = veth" \
--lxc-conf="lxc.network.ipv4 = 192.168.20.30/24" \
--lxc-conf="lxc.network.ipv4.gateway = 192.168.20.1" \
--lxc-conf="lxc.network.link = br800" \
--lxc-conf="lxc.network.name = eth0" \
--lxc-conf="lxc.network.flags = up" \
-d [Docker Image ID]
Ideally we wouldn't have to do as much hacking just to get networking setup in such a way, but this leads to the ability to create multiple bridges attached to different VLANs and segment traffic from different containers and force it to go through some upstream router.