Templates
Save a stack's files once and create stacks from them again and again.
A template is a complete set of Compose files: compose.yaml, an
optional .env and every file next to them. You edit its draft and
publish versions. Stacks are created from a published version.
Create a template
- Open Templates and press New Template. Enter a name, a short description and tags, then press Create Template.
- On the Files tab, edit the starter
compose.yaml, add a.envand the files your services need. - Press Publish Version, enter a Version such as
1.0.0and What Changed. The version's files are frozen; you can keep editing the draft.
A template needs a Compose file such as compose.yaml at the top, must
not set a top-level name:, and holds up to 5,000 files and 33.55 MB (the
size limit can be changed, see
Configuration).
Under Settings you can upload an icon (PNG, JPEG, GIF, WebP or SVG, up to 262.14 kB and 1024 × 1024 pixels), and change the details, tags and links.
To turn a running stack into a template, open it and choose More Stack Actions → Save as Template. Save it as a new template, or into an existing template's draft (this replaces the draft). Leave out data folders such as databases or uploads.
Create a stack from a template
- Open Stacks → Create Stack ▾ → Create Stack From Template, or press Create Stack on a template's page.
- Pick the template, its Version, the Environment and a Name.
- Change the
.envvalues for this stack, such as passwords. - Press Create Stack, or choose Create Stack ▾ → Create and Deploy to deploy it right away.
A template's What It Runs marks the services behind a Compose profile:
they start only when COMPOSE_PROFILES in .env names their profile.
The stack gets its own copy of the files. Changing the template later does not change the stack.
Versions
The Versions tab lists every published version.
- Restore Draft puts a version's files back into the draft.
- Duplicate as a New Template makes your own copy of a version.
- Deleting a version does not affect stacks created from it.
Share templates
New templates are private. Settings → Make Public shares a template with other Docker Manager installations.
Public means public
Anyone who knows your Docker Manager's address can download every file of
every published version of a public template, including .env. Remove
passwords, keys and tokens and publish a clean version first.
To use templates from another Docker Manager:
- On the Docker Manager that shares the templates, open Templates → Template Sources and copy the address under Share Your Templates.
- On yours, open Templates → Template Sources, press Add Template Source and paste it. The address must use HTTPS. Only the owner can add sources.
Its public templates now appear on your Templates page, marked with its name. The list refreshes every 30 minutes by default, or press the sync button next to the source.