Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Docker Networking Blarg
##Cans and Some String
![The little daemon that could][midockerd]
_by [Tim Fall]_ [](
So we can all agree that Docker is cool. Containers are cool, repeatability is cool, portability is cool, we're all cool. Everything is unicorns and rainbows. But something is missing in this fairy tale land, and it's something we all like to forget about. With this wide world of other containers and services out there ("world wide web" anyone?), we want to make use of these things and connect ourselves in.
That's it! We forgot networking!
####Current State of Affairs
Well that's not **quite** fair, we didn't _forget_ it per say, we just all got caught up in building cool containers and plumb left it for later.
#####Docker Networking
#####`Flannel` and `Weave`
{#flannel-and-weave, workings and drawbacks}
####`libnetwork` (*vendor certification not required)
[`libnetwork`][libnetwork-blog] is a new project from Docker designed to bring full-fledged networking to containers and make them a first class citizen. With the [aquisition of](, an experienced team of networkers has been hard at work making this a possibility.
The `libnetwork` project is designed to create a framework, that will live alongside other core frameworks in Docker (`libcontainer`,Compose, Machine, Registry, and Kinematic) and provide support for networking options. This will primarily take the form of a set of APIs against which people can create container-based options for a range of networking solutions. You can check out more about how `libcontainer` works [on the blog post][libnetwork-blog] and on the [repository][libnetwork-repo].
####MidoNet and the `libcontainer` Future
MidoNet is an open source, decentralized, software SDN. It has already been integrated with a number of different projects, including OpenStack and OPNFV. It therefore seemed like a natural fit for the first member of the `libcontainer` family.
MidoNet uses an agent to manage connections between containers (intra and inter-host) and creates point to point tunnels for passage of traffic. All data is stored in a clustered database system, which is directly accessible via a number of API endpoints.
<basic midonet diagrams here>
For more detailed information on MidoNet see [][midonet-org] and [](
####Container Networking
Before the introduction of `libcontainer` MidoNet relied on the `docker event` interface to gather state information about running containers and to watch for new events. This approach worked, but did not provide the truely native support of a first-class citizen network.
{#event diagrams here}
- Lightweight. No need for complex listeners or loops
- Simple. Uses the same tools and cli as normal `docker`
- Functional. Enabled complex networking without touching `docker` core
- Reactionary event driven mechanism
- One way street. No native mechanism for container awareness of network conditions
- Additional tooling. Complex network changes required the use of the `midonet` cli to edit the network directly
`libcontainer` allows for a mechanism driver to provide networking functions that core `docker` functions are aware of. A "plugin" framework allows for direct support of networking functions between containers and across hosts. There is also work being done on supporting cross-engine networking.
{#libcontainer diagram and description}
###Get Started
The current working version of MidoNet with `docker` is part of a larger project to make MidoNet compatible Docker, Swarm, Kubernetes, Mesosphere, and other distributed systems. You can find the project and instructions for how to run it on the project's repository.
>[MidoNet Bees: MidoNet for Swarm, Kubernetes, and Mesosphere][bees]
Both `libcontainer` and MidoNet are open source. You can get source from the official repositories.
- {#libcontainer repo}
- {#midonet repo}
You can talk with developers, get help, and make contributions here.
- `#docker-dev` and `#docker-networking` irc channels on freenode
- MidoNet on [Slack][midonet-slack]
[Tim Fall]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment