✦ Sprites 2 Docs

Bring Your Own Docker Image

Start Sprites from a public or private container image, so your existing environments move over unchanged.

On this page

What it is

By default, a Sprite uses the Sprites base image (Ubuntu with a sprite user, sudo, and common tools). You have two ways to change that:

  • Customize the Sprites base image: start from the default, install your packages and software, and checkpoint it as a template.
  • Bring your own image: start from any OCI (Docker) image, public or private, such as ubuntu:24.04, python:3.12-slim, or your own ghcr.io/acme/agent-env:1.4.

Sprites pulls your image once into a base image for your organization. From there it works like any other Sprite: you can checkpoint it and fork it.

Why it matters: your existing environments and packaging move into Sprites as they are, and they get the same checkpoint-and-fork workflow as everything else.

Step by step: a public image

1. Pick an image with an explicit tag

The image needs an explicit tag or digest. latest (or no tag at all) is refused with 400 invalid_image_ref. It must also have a linux/amd64 variant.

2. Create the Sprite

ssh my-org@sprites.dev sprite create worker ubuntu:24.04
# HTTP API
curl -sS -X POST "https://api.sprites.dev/v1/sprites" \
  -H "Authorization: Bearer $SPRITES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"worker","config":{"image_url":"ubuntu:24.04"}}'

You can set resources at the same time:

curl -sS -X POST "https://api.sprites.dev/v1/sprites" \
  -H "Authorization: Bearer $SPRITES_TOKEN" \
  -H "Content-Type: application/json" -d '{
    "name": "agent-1", "labels": ["agent"],
    "config": {"image_url": "ubuntu:24.04", "max_cpus": 4,
               "max_ram_gb": 8, "max_disk_gb": 100}}'

3. Wait for the pull

The create call returns once the Sprite is running. The first time your organization uses an image, pulling it can take minutes. After that, the pulled image is reused.

4. Check it

ssh my-org@sprites.dev sprite exec worker 'cat /etc/os-release && whoami'
Note

Commands run as the image’s default user: sprite in the base image, but usually root in other images, which also have no sprite user. Commands start in /home/sprite on the base image but in / on most other images, so use absolute paths.

Step by step: a private image

1. Build the credentials

image_auth is the base64 of USER:PASSWORD or USER:TOKEN for the registry. That’s the same auth value you’d find in ~/.docker/config.json.

IMAGE_AUTH=$(printf '%s:%s' "$GHCR_USER" "$GHCR_TOKEN" | base64 | tr -d '\n')

2. Create the Sprite

ssh my-org@sprites.dev sprite create agent-2 ghcr.io/acme/agent-env:1.4 --image-auth "$IMAGE_AUTH"
# HTTP API
curl -sS -X POST "https://api.sprites.dev/v1/sprites" \
  -H "Authorization: Bearer $SPRITES_TOKEN" \
  -H "Content-Type: application/json" -d "$(jq -n \
    --arg auth "$IMAGE_AUTH" '{name: "agent-2", config: {
      image_url: "ghcr.io/acme/agent-env:1.4", image_auth: $auth,
      max_disk_gb: 100}}')"

The credentials are used for the pull at create time and are never stored.

Reuse it: image → template → forks

The image is pulled once for your organization. To also skip your own setup steps every time, build a template from it:

  1. Create a Sprite from your image (above).
  2. Add anything else it needs and register its services.
  3. Checkpoint it: ssh my-org@sprites.dev checkpoint agent-2 ready.
  4. Fork it for each workload: ssh my-org@sprites.dev fork agent-2 ready job-17.

Forks start from the checkpoint and never pull the image again. See Forking and Reusable Templates.

The image is fixed at creation

You can’t change a Sprite’s image later. Updating image_url fails with image_immutable. To move to a new image version, create a new Sprite (or build a new template).

When an image fails

An image that can’t be pulled or built fails the create (or start) with one of these error codes. The message explains why.

CodeMeaning
invalid_image_refMissing tag, or latest. Use an explicit tag or digest.
image_auth_failedThe registry refused access. Check image_auth. Some registries (such as GHCR) also return this for a repository that doesn’t exist.
image_not_foundNo such image or tag.
image_unsupportedFor example, no linux/amd64 image.
image_pull_size_exceededToo large (HTTP 413; the message gives the size and limit).
image_build_timeoutPreparing the image took too long.
image_publish_failedThe prepared image couldn’t be published.

If the create fails, no Sprite is created; the error is in the create response. If an existing Sprite’s image fails when it starts, the Sprite keeps the code in last_error and the message in last_error_message (see sprite get).

Alternative: run Docker inside a Sprite

If you’d rather run containers than replace the base image, Docker works inside a Sprite. Run dockerd as a service so it survives stops, restores and forks:

# Inside the Sprite
sudo apt-get update && sudo apt-get install -y docker.io
sprite-env services create dockerd --restart always -- sudo /usr/bin/dockerd
sprite-env services start dockerd
sudo docker run -d --restart unless-stopped --name web -p 8080:80 nginx:alpine

Images, containers and volumes live on the Sprite’s filesystem, so checkpoints and forks include them.