Posts

Showing posts from January, 2019

Differentiating Environments in Docker Compose - And A Hack For Jenkins Plugin

Image
Docker Compose orchestrates the launch of multiple containers for an application on a single Docker host. A YAML file (usually named docker-compose.yml) describes how each container is going to be deployed (volumes, ports, environment variables) and how they are related to one another (Apache, PHP, and MySQL, for example). One less known feature of Docker Compose is that you can combine multiple YAM files and Compose will merge them. You can, for example, define different database parameters (host, username, password, database/schema) for different environments (production and development) by writing a base file and then more specific files for each. Lets take this base file: docker-compose.yml version: '3' services:   web:     image: php:7.3.0-apache     container_name: site-web     depends_on:       - db     volumes:       - ./site/:/var/www/html/     ports:     ...