Chapter 3. User-Defined Networks

In this chapter, we will cover the following recipes:

  • Viewing the Docker network configuration
  • Creating user-defined networks
  • Connecting containers to networks
  • Defining a user-defined bridge network
  • Creating a user-defined overlay network
  • Isolating networks

Introduction

Earlier versions of Docker relied on a mostly static network model, which worked relatively well for most container networking needs. However, if you wanted to do something different, you weren't left with many options. For instance, you could tell Docker to deploy containers to a different bridge, but there wasn't a strong integration point between Docker and that network. With the introduction of user-defined networking in Docker 1.9, the game has changed. You can now create and manage bridge and multi-host networks directly through the Docker engine. In addition, the door has also been opened for third-party network plugins to integrate with Docker through libnetwork and its Container Network Model (CNM) model.

Note

CNM is Docker's model for defining a container network model. In Chapter 7, Working with Weave Net, we'll examine a third-party plugin (Weave) that can integrate as a Docker driver. The focus in this chapter will be on the default network drivers natively included with a Docker engine.

The move to a driver-based model symbolizes a great change in Docker networking. In addition to defining new networks, you're now also given the ability to connect and disconnect container interfaces dynamically. This inherent flexibility opens the door to many new possibilities to connect containers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset