Skip to content

Support deploying containers without starting them (for standby/pre-warm workflows) #1809

@dutchess

Description

@dutchess

We'd like to request support for a standby/pre-provision workflow where Kamal prepares containers on a host without starting them yet.


Problem

Some deployment workflows require containers to be fully configured and image-pulled on a host but left in a stopped state, to be activated later with kamal app start. Examples include:

  • Failover standby servers — keep a warm-standby host with containers fully prepared. On failover, kamal app start activates them near-instantly (image already pulled, container already allocated) rather than requiring a full kamal deploy under pressure.
  • Precise maintenance windows — do all the slow work (build, push, pull, create) ahead of time; the actual switchover at the maintenance window is just a start.
  • Blue/green with deferred cutover — pre-create the "green" containers while "blue" is live; flip at a controlled moment.

Docker's docker create command supports this directly: it allocates the container—filesystem, networking, environment, labels, volumes—but leaves it in the Created state without spawning any processes.

Proposed solution

Expose docker create through kamal so the above workflows are possible without requiring users to construct the docker command manually (which would need to mirror kamal's env args, label args, volume args, network config, etc.).

We have a reference implementation in this PR that takes the form of explicit create subcommands mirroring boot:

  • kamal app create — creates all app containers without starting them
  • kamal accessory create [NAME] — creates accessory containers without starting them

An alternate design would add a --create-only flag to kamal deploy, kamal app boot, and kamal accessory boot that substitutes docker create for docker run and skips proxy registration.

We'd welcome direction on which API design better fits kamal's conventions before refining the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions