I am able to use NOMAD_PORT_blah in an env
block to configure a service port:
env {
POSTGRESQL_PORT_NUMBER = "${NOMAD_PORT_db}"
...
However, I am not able to use the same in a config
stanza for an image that does not accept port specs as env vars, only cli params:
config {
image = "some-image:main"
args = ["run", "api", "--bind", ":${NOMAD_PORT_api}" ]
}
gives
* failed to parse config: * Unknown variable: There is no variable named "NOMAD_PORT_api
I can somewhat see why this might be conceptually (config needs to exist before the container is created while env is injected at runtime) though it seems that maybe the issue is actually that variables are not allowed inside config
at all and you need to use templates – unfortunately this is a bit difficult to search for as config
, variable
, etc are all very generic terms.
What is the simplest way for me to pass in this variable?