The Docker Compose file schema has evolved from supporting client-side deployments on single Docker hosts to stack deployments across Docker Swarm. Different sets of attributes are relevant in different scenarios, and the tools enforce that. Docker Compose will ignore attributes that apply only to stack deployments, and Docker Swarm will ignore attributes that apply only to single-node deployments.
I can make use of multiple Compose files to exploit this, defining the basic setup of my application in one file, adding local settings in one override file and swarm settings in another override file. I've done that with the Compose files in the ch07-docker-compose folder. The core service definitions ...