10 Running multiple environments with Docker Compose

 

We looked at Docker Compose in Chapter 7 and got a good understanding of how to use YAML to describe a multi-container application, and manage it with the Compose command line. Since then we've enhanced our Docker applications to get them ready for production with health checks and monitoring. Now it's time to return to Compose - because we don't need all those production features in every environment. Portability is one of Docker's major benefits. When you package your application to run in containers it works the same way wherever you deploy it, and that's important because it eliminates drift between environments.

Drift is what always happens when there are manual processes to deploy software. Some updates get missed or some new dependencies get forgotten - so the production environment is different from the user test environment, which is different again from the system test environment. When deployments fail it's often because of drift, and it takes a huge amount of time and effort to track down the missing pieces and put them right. Moving to Docker fixes that problem because every application is already packaged with its dependencies, but you still need the flexibility to support different behavior for different environments. Docker Compose provides that with the more advanced features we'll cover in this chapter.

10.1  Deploying many applications with Docker Compose

10.2  Using Docker Compose override files

10.3  Injecting configuration with environment variables and secrets

10.4  Reducing duplication with extension fields

10.5  Understanding the configuration workflow with Docker

10.6  Lab

sitemap