I spent some time in Chapter 5, Adopting Container-First Solution Design building a flexible configuration system into my Docker images for the NerdDinner stack. The core principle of that was to bundle the default configuration for development into each image, but allow settings to be overridden when you run a container. That means we'll use the same Docker image in every environment, just swapping out the configuration settings to change behavior.
That works for a single Docker Engine where I can use environment variables to override individual settings and volume mounts to replace whole configuration files. You can do much more with configuration in Docker Swarm—using Docker config objects and Docker secrets to store data in the swarm that can be delivered to containers. This is a much neater way of dealing with...