Skip to content

Instantly share code, notes, and snippets.

@timfallmk
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save timfallmk/1fb69cd23c5245af8211 to your computer and use it in GitHub Desktop.
Save timfallmk/1fb69cd23c5245af8211 to your computer and use it in GitHub Desktop.
Docker Networking Blarg
##Cans and Some String
![The little daemon that could][midockerd]
_by [Tim Fall]_ [tim@midokura.com](https://cotap.me/timfall)
####Introduction
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
{#docker-options-today}
#####`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 SocketPlane.io](https://blog.docker.com/2015/03/socketplane-excited-to-be-joining-docker-to-collaborate-with-networking-ecosystem/), 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
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][midonet-org] and [midonet.github.com](midonet.github.com).
####Container Networking
#####Yesterday
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}
Pros:
- 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
Cons:
- 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
#####Now
`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]
####Contribute!
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]
[libnetwork-blog]: https://blog.docker.com/2015/04/docker-networking-takes-a-step-in-the-right-direction-2/
[bees]: https://github.com/midonet/bees
[libnetwork-repo]: https://github.com/docker/libnetwork
[midonet-org]: http://midonet.org
[midonet-slack]: slack.midonet.org
[midockerd]: https://slack-files.com/files-pub/T025Q317V-F06E84YDN-47d227d9f5/midockerd_big.png
[Tim Fall]: https://github.com/timfallmk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment