

The only difference is slight configuration changes in the index.html page so we can see which one is which as well as some Apache config which I talk about more below. There are 4 images I use in this lab all of which are running CentOS with Apache. Note: All of the containers I use in these labs are available in my public repo so feel free to download them for testing. I’ll do so with this command… docker run -d -name web1 -net=host jonlangemak/docker:webinstance1 Let’s start a basic web container on the docker2 host.

Let’s look at an example so you can see what I’m talking about. Namely, some of the configuration I thought might happen automagically doesn’t actually happen. Host mode seems pretty straight forward but there are some items you need to keep in mind when deploying it.

Note that my docker1 host now has two IP interfaces. Keep in mind that all these modes area applied at the container level so we can certainly have a mix of different network modes on the same docker host.įor this post, I’m going to use the same lab I used in the first post but with a minor tweak… This allows for you to create custom network configuration which we’ll talk about more in a later post. It tells docker to put the container in its own network stack but not to do configure any of the containers network interfaces. None – This one is pretty straight forward. This means that while other resources (processes, filesystem, etc) will be kept separate, the network resources such as port mappings and IP addresses of the first container will be shared by the second container. Mapped Container mode – This mode essentially maps a new container into an existing containers network stack. This one is sort of interesting and has some caveats but we’ll talk about those in greater detail below. That is, all of the network interfaces defined on the host will be accessible to the container. That being said, what this really does is just put the container in the hosts network stack. Host mode – The docker documentation claims that this mode does ‘not containerize the containers networking!’. There are really 4 docker ‘provided’ network modes in which you can run containers…īridge mode – This is the default, we saw how this worked in the last post with the containers being attached to the docker0 bridge. In this post, I’d like to start covering the remaining non-default network configuration modes.

In our last post we covered what docker does with container networking in a default configuration.
