brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: portainer custom templates take {{ }} variables, so one compose file fits many deploys

Portainer
~/tips/tip-portainer-custom-template-variables

services:

Adds fill-in fields to a Portainer template so the same compose file can be deployed with different values.

A template with fixed values is only half useful. Variables turn it into a small form at deploy time.

services:
  db:
    image: mariadb:11
    environment:
      MYSQL_PASSWORD: "{{ MYSQL_PASSWORD }}"

In the custom templates list, add a template and wrap values in double curly braces. Portainer then lets you set a label, a description and a default for each variable, and shows them as fields when someone deploys the template.

Variables in custom templates are a Portainer Business Edition feature. The compose file itself can come from the web editor, an upload or a Git repository.

Further reading: Portainer docs: Custom templates

More Portainer tips Choose Polling in a Portainer GitOps update when your Git host can't reach Portainer Put Portainer environments in groups and give users access to a whole group Portainer's Edge Agent checks in every 5 seconds, and you can change that docker run -d -p 9001:9001 --name portainer_agent --restart=always \ Deploy the container → Replace All Portainer tips (28) All topics

Link