If I have (simplified), the following docker-compose.yml:
parent: image: parent links: - child child: image: child
Can I construct a docker-compose.override.yml file that will not create or start the child
image?
An undesirable (for me) solution, would be to reverse the files, such that the default yml file would create only the parent
, and the override would create both.
However, I would like the master configuration file to contain the most common usage scenario.
The docker-compose. override. yml is the configuration file where you can override existing settings from docker-compose. yml or even add completely new services.
Docker-compose command doesn't override Dockerfile CMD.
Scale via the docker-compose CLI. When you start your application stack by passing your compose file to the CLI docker-compose you can use the flag –scale to specify the scalability of any particular service specified in there.
In defense of the original poster: I totally get why you would want to do this. The docker-compose way always seems to be "put your variation in the override files", but in the interest of keeping things simple within a large development team, I like:
Here's how I did it in my override files:
# Disable database containers postgres: image: alpine:latest command: "true" entrypoint: "true" mysql: image: alpine:latest command: "true" entrypoint: "true"
The upshot is, all containers are started by "docker-compose up", but those that I've overridden immediately die.
If you want an ever lighter weight container than alpine, try tianon/true.
I really like solution from Ryan. But it can be improved. Create docker-compose.override.yml
next to docker-compose.yml
with content:
# disable services version "3" fluentd: image: hello-world command: hello restart: "no" elasticsearch: image: hello-world command: hello restart: "no"
I believe hello-world
is a smallest image (size: ~1Kb) on the other hand the size of alpine
linux is ~6Mb
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