Docker compose tips
Posted on 2017-06-11 in Trucs et astuces
For my tips about docker, go here.
Sommaire
Use docker-compose.override.yml
As describe here, if you create a docker-compose.override.yml next to your docker-compose.yml, you can override or add values to the docker file. This file is loaded by default. To ignore it, you must use the --ignore-override option.
For instance, with this docker-compose.yml:
version: '2' web: image: example/my_web_app:latest links: - db - cache db: image: postgres:latest cache: image: redis:latest
and this docker-compose.override.yml:
version: '2' web: volumes: - '.:/code' ports: - 8883:80 db: ports: - 5432:5432
when you run docker-compose up, it will be like you used this docker-compose.yml:
version: '2' web: image: example/my_web_app:latest volumes: - '.:/code' ports: - 883:80 links: - db - cache db: image: postgres:latest ports: - 5432:5432 cache: image: redis:latest