Loading...
Loading...
Use when creating, editing, validating, or troubleshooting a Zeabur template YAML. Use when converting docker-compose to Zeabur template. Do NOT use for deploying templates (use zeabur-template-deploy instead).
npx skill4agent add zeabur/agent-skills zeabur-templateAlways useto invoke Zeabur CLI. Never usenpx zeabur@latestdirectly or any other installation method. Ifzeaburis not available, install Node.js first.npx
https://raw.githubusercontent.com/zeabur/zeabur-template-doc/main/| User Need | Document to Fetch | Path |
|---|---|---|
| Create a template from scratch | Step-by-step guide | |
| Convert docker-compose.yml | Migration guide | |
| Look up YAML fields or built-in variables | Technical reference | |
| Naming, design patterns, best practices | Best practices | |
| Debug template errors | Troubleshooting | |
| Pre-deployment checklist | Checklist | |
| Quick all-in-one overview | Comprehensive prompt | |
template: PREBUILT_V2template: GITARBITRARY_GITGITHUBDockerfilerunnerproductiondocker-compose.ymldocker-compose.fullapp.ymldocker buildx build --platform linux/amd64 --target runner -t org/image:tag --push .curl -s "https://hub.docker.com/v2/repositories/ORG/IMAGE/" | grep is_privateis_private: trueghcr.io/org/repodocker-compose.ymldocker-compose.yamlcompose.ymlChart.yamlvalues.yamlnpx zeabur@latest template search postgresnpx zeabur@latest template get -c TEMPLATE_CODE --rawnpx zeabur@latest template deploy -f YOUR_TEMPLATE.yamlnpx zeabur@latest template deploy -i=false \
-f YOUR_TEMPLATE.yaml \
--project-id PROJECT_ID \
--var PUBLIC_DOMAIN=myappnpx zeabur@latest service list --project-id PROJECT_IDnpx zeabur@latest deployment log --service-id SERVICE_IDdocker execnpx zeabur@latest service exec --id SERVICE_ID -- SHELL_COMMANDnpx zeabur@latest service exec --id SERVICE_ID -- ls /app
npx zeabur@latest service exec --id SERVICE_ID -- env | grep DATABASE
npx zeabur@latest service exec --id SERVICE_ID -- nc -z localhost 5432npx zeabur@latest service restart --id SERVICE_ID -i=false -ynpx zeabur@latest project delete --id PROJECT_IDDANGEROUS OPERATION — Before deleting a project, you MUST ask the user for explicit confirmation, clearly stating the Project ID, Name, and createdAt timestamp. Never delete without confirmation.
npx zeabur@latest template create -f YOUR_TEMPLATE.yamlhttps://zeabur.com/templates/XXXXXXnpx zeabur@latest template update -c TEMPLATE_CODE -f YOUR_TEMPLATE.yaml# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
name: ServiceName
spec:
description: |
English description (1-3 sentences)
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/service.svg
coverImage: https://example.com/cover.webp
tags:
- Category
variables: []
readme: |
# Service Name
English documentation...
services:
- name: service-name
icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/service.svg
template: PREBUILT_V2
spec:
source:
image: image:tag
command: # MUST be inside source, alongside image
- /bin/sh
- -c
- /opt/app/startup.sh
ports:
- id: web
port: 8080
type: HTTP
portForwarding:
enabled: true # Auto-expose TCP/UDP ports externally (default: true)
healthCheck: # ensures port is ready before dependents start
type: TCP
port: web # references the port ID above
volumes:
- id: data
dir: /path/to/data
configs:
- path: /opt/app/startup.sh
permission: 493 # 0755
envsubst: false
template: |
#!/bin/sh
exec node server.js
env:
VAR_NAME:
default: value
expose: true
localization:
zh-TW:
description: ...
variables: []
readme: |
# ...
zh-CN:
description: ...
variables: []
readme: |
# ...
ja-JP:
description: ...
variables: []
readme: |
# ...
es-ES:
description: ...
variables: []
readme: |
# ...
id-ID:
description: ...
variables: []
readme: |
# ...| Variable | Purpose |
|---|---|
| Auto-generated secure password |
| Full public URL (e.g. |
| Domain only (e.g. |
| Internal hostname for inter-service communication |
| Port value by port ID (e.g. |
| External hostname for port forwarding (auto-set when enabled, usable in env vars and |
| External forwarded port number (auto-set when enabled, usable in env vars and |
ZEABUR_<PORT_ID>_URLweb${ZEABUR_WEB_URL}console${ZEABUR_CONSOLE_URL}commandsourceimagespec# WRONG -- command at spec level (will be IGNORED, container uses default CMD)
spec:
source:
image: python:3.12-slim
command:
- /bin/sh
- -c
- /opt/app/start.sh
# CORRECT -- command inside source
spec:
source:
image: python:3.12-slim
command:
- /bin/sh
- -c
- /opt/app/start.shNote: The external docs may showatcommandlevel. This is incorrect. Always placespecinsidecommandas confirmed by the JSON schema atsource.schema.zeabur.app/prebuilt.json
# RISKY -- @ at start of value is a YAML reserved indicator (may cause parse errors)
description: @BotFather token
# SAFE -- quote the value or avoid @ at start
description: "Token from @BotFather for Telegram bot"
description: Telegram bot token from BotFathercommand| Image | ENTRYPOINT | Problem |
|---|---|---|
| | |
| none | Safe to use |
| none | Safe to use |
python:3.12-slim-bookwormdomainKeytype: TCPUDPportForwarding: enabled: truedomainKey# CORRECT -- TCP service (e.g. HTTP proxy, database, game server)
spec:
source:
image: some/tcp-service:latest
ports:
- id: proxy
port: 8888
type: TCP # NOT HTTP — clients connect directly
portForwarding:
enabled: true # Auto-expose this port externally
env:
# ...
# WRONG -- using HTTP type for a TCP proxy
spec:
ports:
- id: proxy
port: 8888
type: HTTP # Zeabur's Ingress will intercept CONNECT requests
# Missing portForwarding — users must manually enable in Dashboardinstructions${PORT_FORWARDED_HOSTNAME}${PROXY_PORT_FORWARDED_PORT}${[PORTID]_PORT_FORWARDED_PORT}npx zeabur@latest service exec --id SERVICE_ID -- curl -x http://127.0.0.1:8888 https://ifconfig.conpx zeabur@latest service network --id SERVICE_IDcurl -x http://FORWARDED_HOST:FORWARDED_PORT https://ifconfig.conpx zeabur@latest service port-forward --id SERVICE_ID --enablezeabur-port-mismatch# WRONG -- using :latest tag (may serve cached/stale image)
image: rajnandan1/kener:latest
# CORRECT -- pin to specific version
image: rajnandan1/kener:4.0.16
# WRONG -- hardcoded password
POSTGRES_PASSWORD:
default: mypassword123
# CORRECT -- use ${PASSWORD}
POSTGRES_PASSWORD:
default: ${PASSWORD}
expose: true
# WRONG -- PUBLIC_DOMAIN gives incomplete URL
APP_URL:
default: https://${PUBLIC_DOMAIN}
# CORRECT -- ZEABUR_WEB_URL gives full URL
APP_URL:
default: ${ZEABUR_WEB_URL}
readonly: true
# WRONG -- other services can't reference without expose
POSTGRES_HOST:
default: ${CONTAINER_HOSTNAME}
# CORRECT -- expose + readonly for connection info
POSTGRES_HOST:
default: ${CONTAINER_HOSTNAME}
expose: true
readonly: true
# WRONG -- referencing variables without declaring dependency
- name: app
spec:
env:
DB: ${POSTGRES_HOST}
# CORRECT -- declare dependency first
- name: app
dependencies:
- postgresql
spec:
env:
DB: ${POSTGRES_HOST}
# WRONG -- HTTP type for a TCP proxy/database/game server
ports:
- id: proxy
port: 8888
type: HTTP
# CORRECT -- TCP type + portForwarding for non-web services
ports:
- id: proxy
port: 8888
type: TCP
portForwarding:
enabled: truedomainKeyspec.variablestype: DOMAINdomainKey: PUBLIC_DOMAINdomainKey:
- port: web
variable: ENDPOINT_DOMAIN
- port: console
variable: ADMIN_ENDPOINT_DOMAINreferences/database-configs.mdreferences/complexity-levels.mdcurl -s -o /dev/null -w "%{http_code}" "URL"raw.githubusercontent.comdevelopmainmasterspecdescriptionvariables[].namevariables[].descriptionreadmekeytype${VARIABLE_NAMES}references/hard-won-lessons.md