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.
You may have to switch to version: 3 to do this, I believe on version: 2 you can use the "scale" parameter but I'm not 100% sure.
Anyways, you can override the "replicas" parameter like this:
# docker-compose.prod.yml
version: "3"
services:
db_for_development:
deploy:
replicas: 0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With