I want to remove a container defined in docker-compose.yml file when we run in composition/override with another file docker-compose.prod.yml, by example:
# docker-compose.yml
version: 2
services:
www:
image: php56
db_for_development:
image: mariadb
override with:
# docker-compose.prod.yml
version: 2
services:
www:
image: php70
db_for_development:
[control: override-and-remove] # hypothesis
Then, when running:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
docker-compose -f docker-compose.yml -f docker-compose.prod.yml ps
Actually, i have www
and db_for_development
together.
I want only www
container, not others.
Let's say you want to remove (disable) a service that's defined in your compose file
Contents of
docker-compose.yml
Contents of
docker-compose.override.yml
Done. Now your container will still launch but it's disabled using an empty image