stack_deploy
Deploy or update a Docker stack to a swarm from Compose files, with options for registry auth, pruning removed services, and waiting for rollout convergence.
Instructions
Deploy (or update) a stack to the swarm from one or more Compose files.
Requires the target daemon to be a swarm manager. Re-running with the same name updates the
stack in place. Defaults to detach=True (returns once specs are submitted, not on
convergence); set detach=False to wait for the rollout (give it a generous
timeout_seconds). The swarm analogue of compose_up; watch the rollout with
stack_services / stack_ps.
Does not raise on a non-zero CLI exit — inspect returncode/stderr in the result.
args:
name - Name of the stack to create or update
compose_files - One or more Compose file paths (repeated -c; later override earlier). At least one required.
with_registry_auth - Send registry credentials to swarm agents (needed for private images)
prune - Remove services no longer defined in the Compose file
resolve_image - Image-digest resolution: "always" (default), "changed", or "never"
detach - Return immediately after submitting specs (True) vs wait for convergence (False)
cwd - Working directory for resolving relative Compose paths (defaults to the server's cwd;
copied to the target host if no local docker CLI)
timeout_seconds - Subprocess timeout (default 1800s)
returns: dict - {"returncode": int, "stdout": str, "stderr": str, "truncated": bool}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| name | Yes | ||
| prune | No | ||
| detach | No | ||
| compose_files | Yes | ||
| resolve_image | No | ||
| timeout_seconds | No | ||
| with_registry_auth | No |