---
name: rivet-deploy-image
description: Deploy a Docker image to a Rivet Cloud cluster through the Rivet MCP server, or roll a cluster back to an earlier build. Use when asked to deploy, ship, release, or roll back an app on a Rivet cluster and a shell with Docker is available.
metadata:
  rivet-requires: rivet.deploy.prepare rivet.deploy.rollout
title: rivet-deploy-image
canonical_url: https://skilld.dev/gh/rivet-dev/skills/rivet-deploy-image
last_updated: 2026-10-26T09:03:46.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/rollout.md](https://skilld.dev/api/skills-raw/rivet-dev/skills/rivet-deploy-image/references/rollout.md), [references/runner-image.md](https://skilld.dev/api/skills-raw/rivet-dev/skills/rivet-deploy-image/references/runner-image.md).
>
> If the user asked to install this Skill, run `npx skilld install rivet-dev/skills/rivet-deploy-image`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/rivet-deploy-image`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/rivet-dev/skills/rivet-deploy-image) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/rivet-deploy-image`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/rivet-deploy-image --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/rivet-deploy-image --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Deploy an image to a Rivet cluster

A deploy is a local build, one upload, and two Code Mode operations run through the `execute` tool. It needs Docker and a shell. It does not need the Rivet CLI or any other login.

## Before starting

1. Confirm the session can deploy. If `search` does not list `rivet.deploy.prepare`, the session is read-only or is pinned to a project or namespace, and the deploy cannot run from here. Say so instead of retrying.
2. Pick the cluster. Run `return (await rivet.cloud.v2.clusters.list()).items;` in `execute` and use the `cluster` field of the one to deploy to, which is its name. On a connection pinned to a cluster, `rivet.context()` reports it, and `cluster` is left out of every call below.
3. Check the image. When the app has no Dockerfile for a runner yet, or the first deploy fails to start, follow `references/runner-image.md`.

## Steps

1. Build and measure the image in the shell. The platform must be `linux/amd64`.

   ```sh
   docker build --platform linux/amd64 -t app .
   docker image save app -o image.tar
   wc -c < image.tar                        # content_length
   openssl md5 -binary image.tar | base64   # content_md5
   ```

   The tarball must be 5 GiB or smaller. Measure the exact file that will be uploaded, because the build fails verification when either value differs.

2. Register the build.

   ```js
   return await rivet.deploy.prepare({
   	cluster: "my-cluster",
   	image: "app:latest",
   	content_length: 48213504,
   	content_md5: "1B2M2Y8AsgTpgAmY7PhCfg==",
   });
   ```

   `content_length` is a number, not a string. Pass `file` when the tarball is not named `image.tar`. Keep the returned `build_id`.

3. Run the returned `upload` command in the shell, unchanged. It is a curl command against a presigned URL that is good for that one tarball until `expires_at`, so it carries no Rivet credentials.

4. Roll out, repeating until `done` is `true`.

   ```js
   return await rivet.deploy.rollout({ cluster: "my-cluster", build_id: "<build_id>" });
   ```

   Each call advances one step and returns immediately, so call it again while `done` is `false`. A deploy takes 5 to 10 minutes, and the previous build keeps serving until it finishes. See `references/rollout.md` for each step, the errors, and how to roll back.

5. Report the `build_id` and the `endpoints` from the final result to the user. The `build_id` is what a later rollback needs.

## Rules

- Never rebuild or re-upload to retry a rollout. Call `rivet.deploy.rollout` again with the same `build_id`.
- Use `rivet.deploy.*` for the whole deploy. Do not drive `rivet.cloud.v2.builds.*` or `rivet.cloud.v2.runnerPools.upsert` by hand, because an upsert replaces the pool's settings wholesale and would drop its allowlist.
- Do not guess a `cluster`, `region`, or `pool` name. List them first.
- When a step fails with a `platform` fault, or the deploy only goes through after a workaround, send one report with the feedback tool after telling the user the result, if the server offers that tool.
