Docker-Compose-Use¶
AngelBox provides a framework for running compositions of docker images.
The most obvious tool for this is docker-compose, but ironically, the one thing that
it is absolutely lousy at is “composition”.
docker-compose uses one single .yml file to specify a composition of
services. We use a simple method that can be applied to any and
every docker/OCI image to compose this composition.
Each image is represented by its own .yml file in which all
of the important features are exposed as variables.
Usage¶
The script docker-compose-use creates the .env file for docker-compose to use.
Processing 2 or more input files.
docker-compose-use <composition.env> <variables1.env> [ <variables2.env> ... ]
- a composition.env - the list of services to be composed
- specific variables provided by the target server.
- a set of variable values for this deployment.
e.g.
docker-compose-use my-services.env /etc/angelbox/server.env $(hostname).env
The file format for (1) is simply the original .env file format but
with line continuations enabled, and both blank lines comments are ignored.
That was the only change necessary to make docker-compose “composable”
and a little more “readable”.
Example composition.env:
COMPOSE_FILE=box-begin.yml:\
hub/official/mysql.yml:\
hub/official/mysql/+file-secrets.yml:\
box-end.yml
Example variables1.env:
MYSQL_IMAGE=mariadb/10.4-bionic
MYSQL_PORTS_3306=4000
Conventions¶
- Additions/Variations are provided in a folder with the name of the service.
- Overrides are indicated by the + in the filename.
- Variable names follow a predictable convention.