How can i use variable to assigne a service name

Just to give you the full picture:

You could render your compose files through templating of some sort (you would need to solve this yourself) and pass it to docker compose, like this: {command to render template} | docker compose -f - up -d

The -f - uses the compose file it receives via stdin.

Somewhere in the forum, I gave an example that uses envsubst for simple templating.

Update: this is the somewhere

1 Like