The title is self explanatory: I wasn't able to find a document describing where Go templates are allowed in compose files.
In other words I wish to know which of the following is supported:
version: "3.7"
services:
whoami:
image: "containous/whoami"
environment:
- VALUE='{{.Name}}'
- NAME_{{.Name}}='NAME'
deploy:
labels:
- value={{.Name}}
- name_{{.Name}}=NAME
networks:
- {{.Name}}
I kept searching and apparently the information is actually provided in the official Docker documentation, even if it doesn't explicitly refer to the docker compose file format.
In particular:
You can use templates for some flags of service create, using the syntax provided by the Go’s text/template package.
The supported flags are the following :
--hostname --mount --env
As --labels
is not listed we should assume text/template replacement is not allowed in there.