This is a demonstration of a Multi Docker Compose.
The purpose of this repositoy is ongoing research on "Docker compose" architecture design for easier and elegant control over the services, without duplication.
To create a new environment
mkdir platform-new
touch platform-new/.env
ln -s docker-compose.base.yml platform-new/docker-compose.yml
touch platform-new/docker-compose.override.yml
Tree view visualizing of the filesystem
platform-new/
├── data
│ └── backend1
│ └── config
│ └── main.yml
├── docker-compose.override.yml
└── docker-compose.yml -> ../docker-compose.base.yml
In short:
-
We link the original docker-compose.base.yml.
-
We create new .env file.
- Each .env can configure the inside/outside ports and other user configurable options.
Each override has the example structure:
version: '3'
services:
backend1:
# add content here
volumes:
- ./data/backend3/config:/config
Note:
-
Each platform environment will not to be committed to GIT.
-
The platform environments will be created on the dev machine or production.
-
There can be an infinite number of environments on one machine/node as long as the ports are different in each .env file.
-
Having a data directory which can be mounted/binded to particular location inside the target service.
-
PORT_BACKEND1 is the outside port
-
PORT_BACKEND1_IN is the inside port
-
BACKEND1_PORT is the listen port for the service
cd platform-dev # sample env
docker-compose build
docker-compose up -d
Test: http://localhost:8003
cd platform-dev # sample env
docker-compose ps
-
Multi environment docker compose
-
Building an image instructions
-
Controlling inside env vars
-
Controlling outside env vars in docker -compose
-
Structuring environment variables for easier control and maintaince
-
Multi stage Dockerfile builds
-
https://pspdfkit.com/blog/2018/how-to-manage-multiple-system-configurations-using-docker-compose/
-
https://github.com/docker/awesome-compose/ (for the Go sample insipiration)
Please check the Issues section for a complete list of pending features here.