Skip to content

App templates

Writing a Compose file is chapter 6's honest work, but much of the time you want a known thing — a database, a wiki, a file server — in a known-good shape. App templates are that shape, pre-written: a catalogue of ready stacks and single containers, each asking only for the few values that are yours (a name, a port, a password), then deploying like any stack.

Check — and a confession. The catalogue in this guide's lab is empty, and the transcript keeps the reason verbatim (portainer-lab/transcripts/t11-templates.txt). This chapter is therefore taught from the project's documentation, labelled as such here and in criteria.md — the guide does not pretend the lab clicked a template it never saw.

Where the catalogue comes from

The list is not built into Portainer. When you open the page, Portainer fetches one JSON file — the project maintains it in the open, at a Templates URL set in the settings — and shows what it finds. Transcript t11 is the lab asking for it and being refused by its own network: the sandbox's path answered the TLS handshake with a certificate Portainer could not verify, so the fetch failed, honestly and completely. On an ordinary machine with ordinary internet access the same ask returns the catalogue; pointing the Templates URL at a mirror — or at a catalogue of your own, in the same format — is how larger sites keep a curated shelf.

Using one, and reading one first

Templates come in two types: container templates (one service, a form's worth of questions) and stack templates (a whole Compose file with variables). Deploying one creates an ordinary stack or container, which from then on behaves exactly as chapters 6 and 7 describe — a template is a beginning, not a separate species.

The discipline is chapter 1's, applied to other people's YAML:

  • Read the file before you deploy it. A template is a Compose file a stranger wrote. Look at what image it pulls, what ports it publishes, what volumes it mounts. Ten lines of reading is the whole price of not being surprised.
  • Notice the tag. Templates, like examples everywhere, love latest (chapter 8's moving nickname). Pin it once the thing works.
  • The password field is yours. Anything the template pre-fills as a default credential is a default the whole internet also knows.

Custom templates

Administrators can add custom templates — your own shelf, from a pasted file, an upload, or a Git repository. This is where a small team's standard shapes belong: the database as you run it, the test environment as you build it, with your pinning and your networks baked in. The machinery is the public catalogue's machinery, pointed at files you control — and it inherits the same rule. A custom template is code you hand to everyone who can click it.