Docker 17.06.0-ce-RC5 got announced 5 days back and is available for testing. It brings numerous new features & enablements under this new upcoming release. Few of my favourites includes support for Secrets on Windows, allows specifying a secret location within the container, adds
--format option to docker system df command, adds support for placement preference to docker stack deploy, adds monitored resource type metadata for GCP logging driver and adding build & engine info prometheus metrics to list a few. But one of the notable and most awaited feature include support of swarm-mode services with node-local networks such as macvlan, ipvlan, bridge and host.
Under the new upcoming 17.06 release, Docker provides support for local scope networks in Swarm. This includes any local scope network driver. Some examples of these are
macvlan though any local scope network driver, built-in or plug-in, will work with Swarm. Previously only swarm scope networks like
overlay were supported. This is a great news for all Docker Networking enthusiasts.
A Brief Intro to MacVLAN:
In case you’re new , the MACVLAN driver provides direct access between containers and the physical network. It also allows containers to receive routable IP addresses that are on the subnet of the physical network.
MACVLAN offers a number of unique features and capabilities. It has positive performance implications by virtue of having a very simple and lightweight architecture. It’s use cases includes very low latency applications and networking design that requires containers be on the same subnet as and using IPs as the external host network.The
macvlan driver uses the concept of a parent interface. This interface can be a physical interface such as
eth0, a sub-interface for 802.1q VLAN tagging like
VLAN 10), or even a bonded host adaptor which bundles two Ethernet interfaces into a single logical interface.
To test-drive MacVLAN under Swarm Mode, I will leverage the existing 3 node Swarm Mode clusters.
Installing Docker 17.06 on all the Nodes:
Verifying the latest Docker version:
Setting up 3 Node Swarm Mode Cluster:
Attention VirtualBox Users: – In case you are using VirtualBox, the MACVLAN driver requires the network and interfaces to be in promiscuous mode.
A local network config is created on each host. The config holds host-specific information, such as the subnet allocated for this host’s containers.
--ip-range is used to specify a pool of IP addresses that is a subset of IPs from the subnet. This is one method of IPAM to guarantee unique IP allocations.
Instantiating the macvlan network globally
Deploying a service to the swarm-macvlan network:
Let us go ahead and deploy WordPress application. We will be creating 2 services – wordpressapp and wordpressdb1 and attach it to “swarm-macvlan” network as shown below:
Let us verify if MacVLAN network scope holds this container:
Next, it’s time to create DB backend i.e. wordpressdb1.
Verify if both the services are up and running:
Inspecting the “wordpressdb1” service:
Verifying if all the containers on the master node picks up desired IP address from the subnet:
Cool..I am going to leverage this for my Apache JMeter Setup so that I can push loads from different IPs using Docker containers.
Did you find this blog helpful? Feel free to share your experience. Get in touch @ajeetsraina.
If you are looking out for contribution/discussion, join me at Docker Community Slack Channel.
Know more what’s new upcoming under Docker 17.06 CE release by clicking on this link.