Network interfaces not created in Docker container

481 views
Skip to first unread message

Francisco Javier Ros Muñoz

unread,
Jun 16, 2014, 1:00:42 PM6/16/14
to vagra...@googlegroups.com
Hi everyone,

I want a Docker container to be attached to multiple networks. After trying several options, the different NICs are never created within the container: 'ifconfig -a' just returns the loopback and (NATed) eth0 interfaces. I'm stuck with this, any hint would be more than welcome.

Output of 'vagrant up --provider=docker --debug': https://gist.github.com/anonymous/c2acd88a4dfd7e777f21

Thanks in advance,
fran

Alvaro Miranda Aguilera

unread,
Jun 16, 2014, 10:32:20 PM6/16/14
to vagra...@googlegroups.com
if this a feature that came as part of Docker 1.0? attach to host nic?
can you check the docker version of the host/vm you are using?

Thanks


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Francisco Javier Ros Muñoz

unread,
Jun 17, 2014, 3:35:02 AM6/17/14
to vagra...@googlegroups.com
Hi Álvaro,

Thanks for your input. I'm using Docker version 0.9.1, build 3600720.
From your comment, should I infer that Vagrant networking doesn't work with the docker provider?

Maybe I misunderstood something, but I was expecting Vagrant to set up multiple NICs (eth1, eth2, ...) within the docker container when I declare different 'vm.network' in the Vagrantfile.

Best,
fran

Alvaro Miranda Aguilera

unread,
Jun 18, 2014, 10:43:46 PM6/18/14
to vagra...@googlegroups.com
Hello,

When I use docker to create a docker container, what I usually get is a port exposed to the host. and using vagrant you use 'ports' to map this information.

Say you create a docker container, with port 80 mapped to the host in 80..

http://host:80 will display the web server from the docker.

Why you require eth0/eth1/ethN ?

Long explanation/thinking below:......

the docker container will have access to internet, etc by the host, but you only get ports mapped between host-container or container-container.

NOTE: since docker 1.0 there is a new option to map docker container to a nic in the host, but I haven't used yet.

I haven't seen that docker use eth0 eth1 ethx as it's a container and not a full OS.

as part of docker 1.0 a new option came out that allow you map a docker conainer to the host nic.

outside vagrant, manually have you managed to create eth0 eth1 ethn inside a docker container in the way you want?

Vagrant will automate what you can do manually, but not sure if docker is what you require.

If you want to have eth0, eth1, etc, I will suggest give a try to vagrant-lxc plugin and have a look there, but my first suggestion will be test manually first, docker/lxc and then use vagrant to automate what you require.

Francisco Javier Ros Muñoz

unread,
Jun 19, 2014, 7:08:33 AM6/19/14
to vagra...@googlegroups.com
Thanks a lot for your comments.

I need multiple interfaces within each docker container because I want to closely match a production environment where different subnetworks are used. For this, Vagrant's 'private_network' and 'public_network' are a perfect fit for my needs (at least in case they work along with Docker).
The new feature in Docker 1.0 you refer to isn't what I'm looking for, but thanks for the info.
Outside Vagrant, you can manually configure a container with multiple NICs. E.g. take a look to pipework.

So, I'm starting to think that 'private_network' and 'public_network' don't work at the moment when Vagrant deploys Docker containers. Otherwise, there's something wrong in my config and I'm missing something. I'd like to stick with Docker, but will try vagrant-lxc if I can't find any workaround.

Best,
fran

Alvaro Miranda Aguilera

unread,
Jun 19, 2014, 11:35:17 PM6/19/14
to vagra...@googlegroups.com
Vagrant will automate what you do manually.

IF you can do those nic setup with docker (I assume with the new 1.0 map to nic you could, you need to test), then with vagrant you can automate.

If you create a linux box without docker, those network setup will work for sure.

Alvaro.
Reply all
Reply to author
Forward
0 new messages