Chapter 8. Network simulation: realistic environment testing without the pain

 

This chapter covers

  • Coming to grips with Docker Compose
  • Running a DNS server to perform basic container service discovery
  • Testing your applications on troublesome networks
  • Creating a substrate network for seamless communications across Docker hosts

As part of your DevOps workflow, you’ll likely need to use the network in some way. Whether you’re trying to find out where the local memcache container is, connecting to the outside world, or plumbing together Docker containers running on different hosts, you’re likely to want to reach out to the wider network sooner or later.

In this chapter we’ll show you how to simulate and manage networks by using Docker’s virtual network tooling. This chapter is a small first step toward orchestration and service discovery—subjects we’ll take a deeper dive into in chapter 9.

8.1. Container communication—beyond manual linking

In technique 6 you saw how to connect containers with links and we mentioned the advantages provided by a clear statement of container dependencies. Unfortunately, links have a number of disadvantages. They have to be manually specified when starting each container, containers have to be started in the correct order (so no loops in container linking), and there’s no way to replace a link (if a container dies, every dependent container must be restarted to recreate the links).

Fortunately, tools exist to address these pain points.

Technique 68 A simple Docker Compose cluster

Technique 69 A SQLite server using Docker Compose

Technique 70 Finding containers via DNS with Resolvable

8.2. Using Docker to simulate real-world networking

Technique 71 Simulating troublesome networks with Comcast

Technique 72 Simulating troublesome networks with Blockade

8.3. Docker and virtual networks

Technique 73 Setting up a substrate network with Weave

Technique 74 Docker networking and service features

8.4. Summary