Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Docker (or Linux Containers) for Network Emulation?

Edit: As of March 2019, although I have not tested it, I believe Docker now has the ability to do real network emulation.


Edit: As of May 2015, SocketPlane (see website and repo) has joined the Docker team and they're in the process of integrating their OVS solution into Docker core. It appears as if theirs will be the winner of the various Docker networking solutions.


So I've been using Mininet to run tests on my networking software. It seems to have hit its limits though as Mininet containers are essentially linux containers with only a networking stack. I'd like each container to have its own networking stack, file system AND set of processes - basically I'd like a container as close to a VM as possible. Which brings me to Docker, as I understand, Docker is opposite of Mininet, its containers have a file system and their own processes but not their own networking stack. I'm leaning towards Docker as it has a nice API for forking containers, using the disk space of only the diff. My question is, is it possible to create a set of linux containers (with Docker or similar) with the following container layout + network interface setup?

enter image description here

like image 494
jpillora Avatar asked Jan 08 '14 11:01

jpillora


People also ask

Does Docker use Linux containers?

The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.

Can Docker containers access local network?

Your host can still be accessed from containers in the default bridge networking mode. You just need to reference it by its Docker network IP, instead of localhost or 127.0. 0.1 . Your host's Docker IP will be shown on the inet line.

Which containers are used by Docker servers Linux?

Docker developed a Linux container technology – one that is portable, flexible and easy to deploy. Docker open sourced libcontainer and partnered with a worldwide community of contributors to further its development.

What Docker client command can be used to create a container network?

If you want to add a container to a network after the container is already running, use the docker network connect subcommand.


2 Answers

You can use Pipework for that purpose. It is specifically one of the scenarios it implements (private networks between containers, in addition to the standard Docker network).

like image 79
jpetazzo Avatar answered Oct 10 '22 04:10

jpetazzo


I am aware of two open-source network emulators that use linux containers:

The CORE Network Emulator uses containers and each container has its own filesystem (or partial filesystem, because it only creates mount namespaces for the directories required by the services running on each node).

The VNX network emulator is another option. It uses either KVM or LXC to create virtual nodes (but I have not tried the LXC option, yet).

like image 25
Brian Avatar answered Oct 10 '22 05:10

Brian