Bỏ qua để đến nội dung
Apps (Docker) Deploy and run Docker containers and compose stacks on a single server — catalog apps, custom images, build-from-git, and resource cleanup.

Apps (Docker)

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

The Apps section of a server (/servers/:id/apps) is the box-level home for Docker: everything containerized that runs on this machine. It’s organised like a condensed Portainer into three tabs — Stacks (the default), Containers and Resources (images, volumes and networks). Docker apps and Compose stacks are on every plan: creating, building, rebuilding and rolling back an app or stack, its env and an attached database work on Free and Plus too, and a new app or stack counts against your plan’s shared quota across all servers (Free 3, Plus 5 per server, Pro and Max unlimited; over it → 402 app_limit). Adopting containers, PR previews, path routes and shared variables return 403 tier_required below Pro. The Docker Engine extension installs on every plan.

For the account-wide roll-up across every server, use fleet Apps; this page is where you do the deep, per-box work.

  1. On the Stacks tab click Deploy stack (or the dashed Deploy card on the Containers tab) — both open the same deploy drawer.
  2. Pick a source:
    • Catalog — a one-click app or stack template (n8n, Ghost, an AI UI, and more). Fill in the template’s fields (domain, and any app-specific values).
    • Custom — bring your own image (a single container) or paste a compose file (a stack).
    • Git — point at a Git repository and MZPanel builds it on the box (see below).
  3. Give it a name and a domain. For a container, set the internal port the app listens on; MZPanel wires up the nginx vhost and issues SSL for you.
  4. Click Deploy. Output streams live; when it finishes the drawer closes and the owning tab remounts to show the new app.

Containers tab

  • Lifecycle — start, stop, restart, pause/unpause and remove any container, with an inline row spinner and error banner (no toasts).
  • Logs — tail recent output, or follow it live.
  • Console (exec) — run a shell command inside a container.
  • Stats — live CPU/memory for a running container, plus a metrics history chart.
  • Manage (for MZPanel apps) — edit and redeploy in place (image, env, port, memory), build from git, view releases and roll back, manage the env store, and set up per-PR previews.
  • Adopt — a container created outside MZPanel (raw docker run) shows an Adopt button to bring it under management.
  • Clear stopped — prune exited containers.

Stacks tab

  • Lifecycle — start (up), stop (down), restart and delete a stack.
  • Update images — pull newer images and recreate.
  • Edit compose — read the current compose, edit it, and redeploy.
  • Env / Build / Releases — the same env store, build-from-git and rollback as apps, when the stack was built from git.
  • Adopt — an external compose project (started outside MZPanel) can be adopted under management while keeping its original project name.
  • Open a service — click a stack’s service to jump to its container drawer.

Across apps and stacks (plan 14/15)

  • Multiple domains per app — add extra hostnames to an app, remove them, or make one the primary (app.domain-add · app.domain-remove · app.domain-primary); the Domains section also holds Cloudflare only and the opt-in 1–10 s Micro-cache (app.microcache {name, enabled, ttl?, query?}); each new name gets its own vhost and, optionally, a Let’s Encrypt certificate.
  • Attach a database — create a MariaDB or PostgreSQL database for an app and inject its credentials (app.db-attach {name, engine: mariadb|postgres, db?}); app.db-detach removes the link. The new password is printed once and never stored in job logs; the job is never queued for an offline box.
  • Image updates — Check updates compares running images with the registry (docker.update-check, optionally apply); opt-in auto-update per app or stack (app.auto-update {name, enabled} · stack.auto-update {name, enabled}; every plan).
  • Health-gated updates — app.update (image, port, memory, CPUs, restart policy, pull, healthTimeout) waits for the new container to become healthy.
  • Safe remove — removing a managed app also removes its domain, vhost, certificate and data dir; dropping its attached database (dropDb) and named volumes (dropVolumes) is opt-in and off by default. External containers are a plain docker rm; stack services are managed from their stack.
  • Private registries — pull from a saved registry connection (/connect/registries; MCP registry_connections_list, registry_connections_verify).
  • Path routes — serve an app or stack under a path of a domain (route.add {domain, path, targetKind: app|stack, target, strip?, websocket?}, route.remove, route.list; Pro).
  • Shared variables — org / project / environment variables merged into an app’s env (MCP env_vars_*, applied with projects_env_apply; Pro).
  • Move or clone to another server — the Move section of an app or stack runs a background backup → restore → DNS/domain cutover (Pro, both agents ≥ 0.2.122). See moves_* below.

Resources tab

  • Images — list, pull (with optional private-registry auth), scan, and remove; prune dangling images.
  • Volumes — create, remove and prune.
  • Networks — create (driver + subnet), remove and prune.
  • Disk usage — docker df plus a system prune to reclaim space.

Every action dispatches a job to this server’s agent, which runs it natively in Go (the agent shells out to docker/docker compose directly, never to a helper script). The tabs read live inventory that the agent pushes to the control plane:

TabReads (inventory kind)Mutations (job kinds)
Containersdockerdocker.start/stop/restart/pause/unpause/remove/logs/logs-follow/stats/exec, container.prune, and app.* for managed apps
Stacksstacksstack.list/deploy/up/down/restart/delete/pull/get/update/adopt (+ stack.build/releases/rollback/env-* for git stacks)
Resourcesimages, volumes, networksimage.*, volume.*, network.*, docker.df, docker.system-prune

State lives on the box, not in MZPanel’s database:

  • Single-container apps are registered at /etc/mz/apps/<name>.conf.
  • Stacks live under /etc/mz/stacks/<name>/ (compose file, .env, releases).
  • Build-from-git clones and builds on the VPS — with a Dockerfile it builds that; without one it uses Nixpacks auto-detect (Node, Python, Go, Ruby, …). A RAM/disk preflight runs first so a low-memory box isn’t pushed over the edge. A new app must answer on its port within 60 seconds of its first start, or the build fails with health_check_failed and the app stays in place for a redeploy.
  • Uploaded source (from an AI agent, apps_source_upload + apps_deploy) lands in /var/lib/mz/app-sources/incoming/ and is used once; a successful build keeps the last three archives under /var/lib/mz/app-sources/<name>/ so rebuild and rollback work without Git.

Reads come from the cached inventory (instant), and each mutation triggers a re-push so the list reflects the new state.

Everything here maps to an mz command on the box — the same engine the dashboard drives:

Terminal window
mz docker status --json # every container on the box
mz app create myapp --domain app.example.com --image ghost:5 --port 2368 --json
mz app domain-add myapp www.example.com --json
mz app auto-update myapp on --json
mz stack list --json # every compose stack
mz stack create mystack --domain s.example.com --port 8080 --compose-b64 <b64> --json

Container lifecycle is mz docker start|stop|restart|remove <container>; managed apps use mz app start|stop|restart|delete <name>; stacks use mz stack up|down|restart|delete <name>. Pass --json for machine output. See The mz CLI and the command catalog.

GoalMCP toolREST / job
List containers / stacksdocker_ps, stacks_list, servers_docker_all, servers_stacks_allGET /v1/servers/docker/all · GET /v1/servers/stacks/all
Images / volumes / networksservers_docker_resources_allGET /v1/servers/docker-resources/all
Start / stop / restart a containerdocker_control (preview, then apply: true)job docker.start …
Deploy code (local folder or Git)apps_source_upload → curl → apps_deploy → apps_deploy_statusPOST /v1/servers/{id}/apps/source-upload · POST /v1/servers/{id}/apps/deploy · GET /v1/servers/{id}/apps/deploy/{jobId} (playbook)
Deploy code, MZPanel picks the serverapps_placement, apps_fleet_source_upload → curl → apps_fleet_deployPOST /v1/apps/placement · POST /v1/apps/source-upload · POST /v1/apps/deploy
Every app of the fleet (state, URL, last deploy, load)apps_list_allGET /v1/apps
Create / update an appjobs_createapp.create (apps & stacks quota), app.update, app.domain-add, app.db-attach
Deploy / edit a stackjobs_createstack.deploy (apps & stacks quota), stack.update, stack.up, stack.down
Container metricscontainers_metrics_history
Move / clone to another servermoves_create → poll moves_get → moves_cutover / moves_dns_done / moves_retryPOST /v1/moves (Pro)
Shared variablesenv_vars_list, env_vars_set, projects_env_preview, projects_env_apply

Always call jobs_schema for the exact body first. Not available to API tokens: docker.exec (interactive shell in a container) and app.env-sync / stack.env-sync (applied through projects_env_apply). Deleting an app or stack (app.delete, stack.delete, stack.down) needs the sites:delete scope; volume prunes need data:delete. A move’s preflight returns 409 codes such as server_offline, agent_outdated, domains_held, target_conflict or move_in_progress.

  • Offline servers are read-only. When the agent is offline this section shows the last-known containers and stacks from cache (or an “Agent offline” state); lifecycle actions need the agent connected. The Deploy drawer on an offline server says so and keeps Deploy disabled (as the fleet deploy does for an offline target), so a deploy never sits queued. Bring it online to run real Docker actions.
  • Docker must be installed first. A box with no Docker engine has nothing to list. Install Docker Engine from the server’s Extensions (every plan), or pick Docker when you provision the server, before deploying.
  • 402 app_limit. A new app or stack over your plan’s Docker apps & stacks quota (Free 3, Plus 5 per server) is refused; delete one or upgrade. Redeploying an existing app or stack is never blocked.
  • Custom compose needs a resolvable web port. If your pasted stack should get a public URL and SSL, map its HTTP service to __MZ_PORT__ — otherwise MZPanel has no port to proxy and SSL to.
  • Adopt keeps the original name. Adopting an external container or compose project preserves its name/project (zero-downtime) rather than renaming it, so running services aren’t disrupted.
  • Builds spike the box. Build-from-git runs on your VPS, so a build is a short CPU/RAM spike; the preflight guard blocks it if the box is too tight on memory.
  • Removing a running container forces it. Remove on a running or paused container passes --force; stop it first if you want a graceful shutdown.
  • Docker apps & stacks — the full concept guide: catalog, env store, build-from-git, rollback, app proxy.
  • Fleet Apps — the account-wide roll-up across every server.
  • The mz CLI — driving the box from the command line.