Did you know that compose accepts stdin for `-f` files? Anything that outputs yaml is a valid "compose provider". Self plug, more on that, https://eskerda.com/complex-docker-compose-templates-using-b...
Did you know that compose accepts stdin for `-f` files? Anything that outputs yaml is a valid "compose provider". Self plug, more on that, https://eskerda.com/complex-docker-compose-templates-using-b...
Try having 40 microservices and quickly iterate between fixing bugs in them. Some you want mounted, others you want running unmounted. I understand the premise is already broken, you do not want 40 microservices, but that's not a precondition you can fix without a time machine.
[[* EDIT: by env vars on the global scope, I mean setting things on the global scope by using an env var, say, you want a certain volume named after an environment variable. You can only use ENVs as values.
# this works
foo: "${SOME_ENV}"
# this does not
${SOME_ENV}: "foobar"Edit: Also, I don't see the need for a turing complete language for something like docker compose, if you need something really complex you can always script a docker-compose.yml generator with all the logic and complexity you need.
* docker compose could be better
* docker compose does not improve that much
* by mixing docker compose with templates you can get complex stuff going, but is not a much advertised feature.
Most of the "cool dev tool env" that appear are based on kubernetes, or something that is _not_ docker compose, which makes them difficult to adopt. I would like docker compose to improve on a direction that makes development easier, that's all.
services:
redis:
...
{{ if some_condition }}
volumes:
bla bla
{{ end if }}
{{ if some_other_condition }}
another_service:
...
{{ end if }}
volumes:
{{ for volume in volumes }}
- ...
{{ end for }}This feels like it's a very incorrect solution to a problem that you're making far more complicated than it needs to be.
The following is just a contrived example. Why would I do that? Because I can
# Bring up services without a command
#
# usage:
# nocmd.sh up -d service_name
function _compose {
docker-compose -f docker-compose.yml $@
}
function nocmd {
cat << EOF
services:
$1:
command: tail -f /dev/null
EOF
}
function nocmd_compose {
local service=${@: -1}
_compose -f <(nocmd "$service") $@
}
nocmd_compose $@