Skip to content

Fix Portainer App Template – Custom Template Not Appearing

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Fix Portainer App Template. We cover key concepts, practical examples, and best practices.

You create a custom App Template in Portainer — either via app-templates.yml or the UI. You navigate to App Templates, but your template isn't listed. Or it appears but clicking Deploy does nothing.

Wrong ❌

# app-templates.yml — custom template file
version: '3'
services:
  app:
    image: nginx:latest
    ports:
      - 8080:80

You configure Portainer to use this file:

```text
Settings → App Templates → URL: https://raw.githubusercontent.com/.../app-templates.yml

Click **Save** — templates page still shows only Portainer's built‑in templates.

## Right ✅

**Correct App Template format:**

Portainer's App Templates use a specific format — not a raw `docker-compose.yml`:

```yaml
version: "3"
templates:
  - title: Nginx Web Server
    type: 1
    description: Simple Nginx web server
    note: Serves static content on port 8080
    logo: https://nginx.org/nginx.png
    platform: linux
    categories:
      - web
    ports:
      - "8080:80/tcp"
    image: nginx:latest
    volumes:
      - /host/path:/container/path
    env:
      - name: NGINX_HOST
        label: Server Name
        default: localhost
    restart_policy: always

**Register the template in Portainer:**

1. **Settings → App Templates**
2. **URL:** Paste the raw URL to your `app-templates.yml`
3. Click **Sync templates** (or **Save**)
4. Navigate to **App Templates** → refresh the page

Your template should now appear under the **Custom** section.

**For UI‑created templates:**

1. **App Templates → Custom templates → Add custom template**
2. Fill in the form:
   - **Name:** Nginx Web Server
   - **Image:** `nginx:latest`
   - **Ports:** `8080:80`
   - **Categories:** `web`
3. Click **Add**

Template appears immediately.

**If the deploy button doesn't respond:**

The template may require an environment variable or volume that doesn't exist on the target. Check the **Logs** tab during deployment for specific errors.

## Root Cause

Portainer's App Templates have a specific JSON Schema. A raw `docker-compose.yml` won't work — it must be wrapped in the `templates:` array with proper metadata fields (`title`, `type`, `image`, `platform`).

## Prevention

- Always use Portainer's **App Template format** — not raw compose syntax.
- Use **Categories** to group templates (e.g. `web`, `database`, `monitoring`).
- Test the template URL by fetching it from the Portainer server's shell before registering.
- For private templates, host the YAML on an internal web server or Portainer's own file system.


## Common Mistakes with app template

1. **Using `return` to exit a function early instead of wrapping a pure value in the monad**
2. **Mixing let bindings with <- bindings in do notation, producing type errors**
3. **Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors**

These mistakes appear frequently in real-world PORTAINER code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

## Practice Exercise

**Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.**

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

## FAQ

<details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Can I have multiple template URLs?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: No — Portainer supports one external URL. For multiple templates, combine them into one YAML file.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Why don't my templates appear for non‑admin users?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Custom templates are visible only to administrators by default. Change the <strong>Access control</strong> on the template to share with teams.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Can I use environment variables in templates?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Yes — define them in the <code>env:</code> block. Users are prompted for values during deployment.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: How do I update a template after it's registered?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Re‑sync the URL in <strong>Settings → App Templates</strong> → <strong>Sync templates</strong>. UI‑created templates must be edited manually.</p>
</div></details>

---

*App Templates are covered in the [DodaTech Portainer Stacks course](https://dodatech.com/courses/portainer).*

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro