Docker host mode for networking is cool

Docker host mode for networking is real useful, many times I need to have a container with all its container goodness but I need the same container have access to the host networking stack. This is where the magic ‘–net=host’ flag on the docker command line comes in handy. When you run a container with this flag the container will not get an isolated network stack. I have used this functionality to containerize software that normally expected to use and see the host network stack, for example OpenStack Neutron. OpenStack Neutron uses the host network namespace extensively to create software definable networking for OpenStack, by containerizing Neutron and keeping the host networking the neutron software runs happily.

You ca quickly test this this feature out,

First create a container with the above flag

#docker run --net=host -it ubuntu /bin/bash

Next do a list of the network interfaces,

#ip a

you will see the interfaces listed are the same as your host.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s