Lets take a look at the different networking options for Docker.
Native Docker Networking
- On startup Docker creates a Ethernet Bridge docker0 on the Linux Kernel
- docker0 creates a virtual subnet on the Docker host
- Docker creates a pair of virtual Ethernet interface on each container
- One of the Ethernet interface is the eth0 in the container
- Another Ethernet interface will have a unique name in the form of veth* (e.g.vethABI3IC) and is bind to docker0
- User can customize docker0
- Advanced Docker networking can be found here
image source: http://www.infrabricks.de/assets/images/docker_network_basics1.png
Flannel
- reference articles An etcd backed overlay network for container, article1 and article2
- Used to be called Rudder
- An etcd backed overlay network for container
- flannel uses etcd for storage of both configuration data and subnet assignments.
- Upon startup, a flannel daemon will retrieve the configuration and a list of subnet already in use
- Select an available subnet (a randomly picked one) and attempt to register it by creating a key in etcd
- Works under Kubernetes
- Resolve the problem of native Docker networking where network address was hidden from the network outside of the Docker host machine
- It can work on any exiting network without changes to that network.
image source: https://github.com/coreos/flannel/blob/master/packet-01
Weave
- reference article
- An overlay networking system for Docker container
- Open source back by a commercial company Zettio
- The system consists of two components:
- Weaver - a virtual network switch and router implemented in Go that runs within a Docker container on each networked host.
- Weave - a script that wraps the Docker command line in order to start Weaver, connect containers to the Weave virtual network, and assign IP addresses to them.
- Zettio founder Alexis Richardson said "Weave makes the network fit the application, not the other way round"
- Can be think of as "a giant Ethernet switch to which all the containers are connected"
- Weave network can be encrypted
- Simplies the process of connecting containers together instead of using Open vSwitch
image source: http://www.infoq.com/resource/news/2014/09/zettio_releases_weave/en/resources/1Weave.png
Pipework- reference article.
- Docker creates a special Linux bridge called docker0 on startup.
- All containers are automatically connected to this bridge and the IP subnet for all containers is randomly set by Docker.
- Currently, it is not possible to directly influence the particular IP address of a Docker container.
- pipework is a shell script which user can use to add another interface to a container with a specified IP address.
SDN is an hot topic and Docker is another hot topic and what is going to happen when we put SDN and Docker together?
Recently a new startup SocketPlane has an idea of bringing Open vSwitch to the Docket host. I read an article from SDN Central about SocketPlane:
- To have a container that is going to be able to manage the data path
- Also able to manage either overlays or underlays
- Will focus on network management and network services instead of the network system
- Will also address problems with DevOps with various Configuration Management Tools
When we go to SocketPlane's website you will see "Native to Docker", "Familiar to NetOps" and "Application Friendly". I think this 3 phases summarize the product direction that this company is heading. One thing to note is that the founders of this startup are all veterans of the OpenDayLight projects along with former executive from OpsCode/Chef.
I have another post on OpenDayLight previously, please take a look if you are interested. :)
Bring SDN to Docker can open up using a container for NFV or in this case NFD (Network Function Dockerization) <- a new name that I come up with based on the word "Dockerize"
Reference:
"CoreOS." CoreOS Blog ATOM. N.p., n.d. Web. 26 Oct. 2014.
"Coreos/flannel." GitHub. N.p., n.d. Web. 26 Oct. 2014.
"Zettio Releases Weave for Docker Networking." InfoQ. N.p., n.d. Web. 26 Oct. 2014.
"Docker Networking Made Simple or 3 Ways to Connect LXC Containers - Codecentric Blog." Codecentric Blog. N.p., n.d. Web. 26 Oct. 2014.
"OpenDaylight Coders Open Shop on a Docker Startup." SDNCentral. N.p., n.d. Web. 26 Oct. 2014.
"Docker Networking Made Simple or 3 Ways to Connect LXC Containers - Codecentric Blog." Codecentric Blog. N.p., n.d. Web. 26 Oct. 2014.