zeabur-service-exec
Zeabur Service Exec
Always use
npx zeabur@latestto invoke Zeabur CLI. Never usezeaburdirectly or any other installation method. Ifnpxis not available, install Node.js first.
Run commands inside a running service container. Useful for debugging, inspecting files, checking env vars, testing connectivity, or running one-off database operations.
Basic Usage
Commands and arguments go after --:
npx zeabur@latest service exec --id <service-id> -- <command> [args...]
Database Operations
# MongoDB - query, update, delete data
npx zeabur@latest service exec --id <mongodb-service-id> -- mongosh --eval 'db.users.find({})'
npx zeabur@latest service exec --id <mongodb-service-id> -- mongosh --eval 'db.sessions.deleteMany({title: /test/i})'
# PostgreSQL - run SQL queries (PGPASSWORD is set automatically in Zeabur containers)
npx zeabur@latest service exec --id <pg-service-id> -- psql -U postgres -c 'SELECT * FROM users LIMIT 10;'
# MySQL - run SQL queries (use env var to avoid interactive password prompt)
npx zeabur@latest service exec --id <mysql-service-id> -- sh -c 'mysql -u root -p"$MYSQL_ROOT_PASSWORD" -e "SHOW DATABASES;"'
# Redis - run commands
npx zeabur@latest service exec --id <redis-service-id> -- redis-cli KEYS '*'
Examples
# List files
npx zeabur@latest service exec --id <service-id> -- ls -la
# Check environment variables
npx zeabur@latest service exec --id <service-id> -- env
# Check a specific env var
npx zeabur@latest service exec --id <service-id> -- sh -c "echo \$DATABASE_URL"
# Test database connectivity
npx zeabur@latest service exec --id <service-id> -- sh -c "nc -zv postgres 5432"
# Check running processes
npx zeabur@latest service exec --id <service-id> -- ps aux
# Read a config file
npx zeabur@latest service exec --id <service-id> -- cat /app/config.json
# Check disk usage
npx zeabur@latest service exec --id <service-id> -- df -h
Flags
| Flag | Description |
|---|---|
--id |
Service ID |
-n, --name |
Service name (prefer --id) |
--env-id |
Environment ID (if multiple environments) |
Tips
- The
--separator is required — everything after it is the command to run inside the container. - For compound commands, wrap in
sh -c "...". - Not all containers have a full shell —
shis more portable thanbash. - Use single quotes outside and double quotes inside when dealing with variable expansion:
sh -c "echo \$VAR". - To find service IDs, use the
zeabur-service-listskill. To check logs without exec, use thezeabur-deployment-logsskill. To manage env vars via CLI, use thezeabur-variablesskill.
More from zeabur/zeabur-claude-plugin
zeabur-deployment-logs
Use when viewing service runtime or build logs. Use when user says "show logs", "why did deploy fail", "check build output", or "debug runtime error".
54zeabur-template
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).
53zeabur-restart
Use when restarting a Zeabur service. Use when user says "restart", "reboot service", or "service is stuck/frozen".
53zeabur-domain-url
Use when services need public URL for redirects or CORS. Use when WEB_URL or similar has trailing slash issues. Use when user reports "redirect goes to wrong URL", "CORS error", or "trailing slash problem". Also use when user says "add domain", "set up domain", "bind domain", "create domain", or "manage domains" for a Zeabur service.
52zeabur-variables
Use for ALL Zeabur environment variable operations — create, list, update, delete, or troubleshoot. Use when user says "set env var", "add variable", "create variable", "update variable", "delete variable", "change env var", or "why is my variable empty". Also use when variables are empty or SERVICE_NOT_FOUND errors.
51zeabur-update-service
Use when modifying service config without full redeploy. Use when updating env vars and restarting single service. Use when user says "change env var", "update config", "fix variable without redeploying", "upgrade service version", "update image tag", or "change service tag".
49