Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
docker-compose lacks an obvious feature - composability!
Composability is just about achievable using the
.env file to set COMPOSE_FILE to a list of files. The default
docker-compose.yml:docker-compose.override.yml can be replaced by a list, making docker-compose theoretically composable.
However, as usual, what docker provides in usefulness, it throws away in terms of the readability of the code used to get there. For those of us who know the value of readability, and its positive contribution to maintainability and sanity, we propose a way to solve the problem:
The simplest idea that could possibly work - a pre-processor for the docker-compose
Docker-compose is great for publishing a set of collaborating servers, but out of the box it's only expecting one docker-compose.yml file. For anything vaguely complex that offers the users some choice it is rarely flexible enough.
The new scheme allows us to present the user with a set of options to choose from, examples, test/production/development configurations etc. And we can make docker-compose composable!
# This is an example server configuration # . # To use this run: # . # > ./docker-compose-use example_server.env # . # Which will turn this file into a .env file ready for # docker-compose to use as the default set of containers # . # ( Lines starting with a single '# ' are removed completely. ) # ( Blanklines are removed completely. ) # ( Whitespace is trimmed. ) # ( \ continuation lines are joined. ) COMPOSE_FILE=\ common.yml:\ base/mariaDB.yml:\ # base/postgres.yml:\ phpfpm/phpfpm.yml:\ # nginx.yml:\ openresty.yml