This is an addition to this question about how to setup VLANs on CoreOS [CoreOS bare-metal vlan networking. My question after is after you set this up, how do you use it?

How do you start a container that puts the ethernet interface of that container into one of those specific VLAN?

1 Answer 1



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 \
--net="none" \
--lxc-conf="lxc.network.type = veth" \
--lxc-conf="lxc.network.ipv4 =" \
--lxc-conf="lxc.network.ipv4.gateway =" \
--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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.