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.
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.