Docker compose with build args

docker-compose.yaml version 2 (docker engine 1.10+, compose 1.6+) supports passing build args like ENV vars from the host to the build like below. I am attempting to use this feature so that I can pass CIRCLE_BRANCH from the build host to the image builder.

build:
context: ./
args:
CIRCLE_BRANCH:

in my circle.yaml I attempt to install the beta version of docker 1.10 and run pip install docker-compose to upgrade docker-compose.

machine:
pre:
- echo ‘DOCKER_OPTS="-s btrfs -e lxc -D --userland-proxy=false"’ | sudo tee -a /etc/default/docker
- sudo curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s – 1.10.0
- sudo chmod 0755 /usr/bin/docker
python:
version: 3.5.0
services:
- docker

test:
override:
- cd dockerfiles/rdp && docker-compose up rdp
dependencies:

override:
- pip install docker-compose
- git clone XXXXX
- XXXX pull base docker container from ECR XXXX

Trying this: Docker-compose.yml env_file is not working?

Try this Circle CI and Docker Compose Version 2 YAML syntax

1 Like