Cannot get Variable replacement in Custom Templates to work #13112
Replies: 2 comments 5 replies
-
|
when looking at the default templates eg. here https://github.com/portainer/templates/blob/v3/stacks/dokku/docker-compose.yml Using the |
Beta Was this translation helpful? Give feedback.
-
|
Hi @phermsdorf can you please give me a breakdown to reproduce this. Can you confirm you are referencing your compose template from a Git Repo, or are you using the web editor. if you are doing Git Based can you please provide screenshots of how you are assigning the variables for the template under "Variables definition" |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Ask a Question!
Hi,
I'm on a Busines Edition of Portainer 2.39.0 LTS and wanted to try out the Custom Templates functionality.
I've defined a compose.yml for the template like this:
I created a new Custom Templated based on this config from a git repo. I've added manually (they were not automatically extracted when pulling the .yml from git) the Variables PULL_REQUEST and WILDFLY_PORT.
When trying to create and start a stack based on this config and supplying a free port value for WILDFLY_PORT like 8090 i get the error message:
Failed to deploy a stack: failed to create compose project: failed to load the compose file : invalid hostPort: {{ WILDFLY_PORT }}So from MPOV it looks like the replacemnt does not take place.
In the preview btw it seems to look correct:
When removing the double qoutes around the ports definition like this
the error changes to a parser error like this:
Failed to deploy a stack: failed to create compose project: failed to load the compose file : failed to parse /data/compose/36/1e997cc8844881123d6e2ec392481e74a1dfae83/portainer-templates/compose-casy.yml: yaml: line 14: did not find expected '-' indicatorI would have expected that the replacement takes place before handing the final file to docker compose.
Any ideas's und suggestions what else to try?
Thanks, Bye Peter
Beta Was this translation helpful? Give feedback.
All reactions