Custom images
Custom images let you choose your machine's environment, with your system packages, Python libraries, and application code ready at boot. Build the environment once and reuse it across your Dedalus Machines.
By default, every Dedalus Machine uses the Dedalus base image, a minimal Ubuntu install. On a machine that uses the base image, you install your toolchain, model runtime, or application code after the machine starts. With custom images, you supply an image containing that environment and launch machines with it pre-installed.
You can use a custom image in two ways: build and upload a local Docker image,
or import an image from a public registry.
Both sources must be built for linux/amd64 and fit the image limits.
Both paths register an image for preparation. Once it is ready, pass its image_id when you
create a machine. Preparation happens once per image, allowing later machines to reuse it.
Upload a local Docker image
Dedalus accepts linux/amd64 images built on any Linux distribution, such as Ubuntu, Debian, or
Alpine.
Dedalus boots your image as a full Linux machine, and the image becomes the machine's root filesystem. Preparation does not install packages into your image or change the ones it has.
Preparation also resets /tmp, /var/tmp, and /run, and gives the machine a unique hostname
and machine ID. Put files you want on every machine elsewhere in the image.
Use an existing image
If a public registry already has the image you want, built for linux/amd64, you can register
it as it is. You do not need to rebuild it. Skip to
importing from a public registry.
Build your image
Start from the base you already use. For example, this image installs an agent and its Python libraries on a Debian-based Python image:
FROM python:3.12-slim
COPY requirements.txt /opt/agent/
RUN pip install --no-cache-dir -r /opt/agent/requirements.txt
COPY agent/ /opt/agent/
A machine does not run your image's ENTRYPOINT or CMD. After the machine is running, start
your processes with an execution or over SSH.
Executions run with your image's ENV, so tools on the image's PATH work without a login shell.
A variable in an execution's own env replaces the image's value for that command. SSH sessions
do not read the image's ENV. Commands run as root in /root, whatever the image's USER and
WORKDIR say.
To change a variable without rebuilding the image, set env when
you register it.
From the directory containing your Dockerfile and agent/, build the image and save it to a file:
docker build --platform linux/amd64 -t agent:v1 .
docker save -o agent.tar agent:v1
The first command builds agent:v1. The second saves it as agent.tar, which you upload to
Dedalus. You can keep the image local without publishing it to a registry.
Upload the saved image with the CLI and wait for preparation to finish:
dedalus images import agent.tar --platform linux/amd64 --idempotency-key agent-v1 --wait
The CLI handles the upload and registration, then waits until the image is ready. Use the returned
image_id to launch a machine.
The archive must come from docker save and be at most 5 GiB. docker export filesystem tars
and arbitrary OCI-layout archives are not accepted.
Upload the image using the HTTP API
Reserve an upload
The HTTP examples below require jq. Compute the archive's SHA-256 checksum and size in bytes,
then reserve an upload with your organization API key:
archive_sha256=$(shasum -a 256 agent.tar | awk '{print $1}')
archive_size=$(wc -c < agent.tar | tr -d ' ')
curl --fail-with-body https://dcs.dedaluslabs.ai/v1/images/uploads \
-H "Authorization: Bearer $DEDALUS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: agent-v1-upload" \
-d "{\"sha256\":\"$archive_sha256\",\"size_bytes\":$archive_size,\"platform\":\"linux/amd64\"}" \
-o upload.json
The response contains source and upload. Keep source unchanged for registration.
upload contains a signed url, its HTTP method, a headers object whose values are arrays,
and an expires_at timestamp.
Upload and register the archive
Send the archive bytes to upload.url before it expires, using upload.method and every returned
header. The signed URL authorizes this upload. Use your organization API key only for the Dedalus
API calls.
jq -r '.upload.headers | to_entries[] | .key as $name | .value[] | "\($name): \(.)"' \
upload.json > upload-headers.txt
curl --fail-with-body -X "$(jq -r '.upload.method' upload.json)" \
-H @upload-headers.txt \
--upload-file agent.tar \
"$(jq -r '.upload.url' upload.json)"
After the upload succeeds, register the returned source:
jq '{source, platform: "linux/amd64"}' upload.json > image.json
curl --fail-with-body https://dcs.dedaluslabs.ai/v1/images \
-H "Authorization: Bearer $DEDALUS_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: agent-v1-register" \
--data-binary @image.json
The source has kind: "docker_archive", an upload_id, and the archive's sha256.
Keep each POST request's idempotency key and body unchanged when retrying it.
The registration response includes an image_id. Continue with
Wait until the image is ready.
Import from a public registry
Find an image in a public repository on one of these registries:
- Amazon ECR Public (
public.ecr.aws) - GitHub Container Registry (
ghcr.io) - Docker Hub (
docker.io) - Quay (
quay.io)
Private repositories are not supported yet.
Find the image digest
Dedalus registers an image by its digest. That way, every machine you launch from the image gets the same filesystem.
The digest must name the linux/amd64 image itself. A multi-platform image has an index that
points to one image per platform, and the index has its own digest. Registering the index digest
fails. Inspect the image and copy the digest listed for linux/amd64:
docker buildx imagetools inspect ghcr.io/acme/agent:v1
Write the reference as the full registry path followed by the digest:
ghcr.io/acme/agent@sha256:4b7a...
Register the registry image
Registering an image asks Dedalus to download and prepare it. The request returns as soon as Dedalus accepts it, and the image is ready to launch some time later.
dedalus images create \
--source '{"kind":"oci","reference":"ghcr.io/acme/agent@sha256:4b7a..."}' \
--platform linux/amd64
image = client.images.create(
source={"kind": "oci", "reference": "ghcr.io/acme/agent@sha256:4b7a..."},
platform="linux/amd64",
)
print(image.image_id)
const image = await client.images.create({
source: { kind: "oci", reference: "ghcr.io/acme/agent@sha256:4b7a..." },
platform: "linux/amd64",
});
console.log(image.image_id);
image, err := client.Images.New(ctx, dedalus.ImageNewParams{
Source: dedalus.F(dedalus.SourceParam{
Kind: dedalus.F[string]("oci"),
Reference: dedalus.F[string]("ghcr.io/acme/agent@sha256:4b7a..."),
}),
Platform: dedalus.F(dedalus.ImageNewParamsPlatformLinuxAmd64),
})
if err != nil {
return err
}
fmt.Println(image.ImageID)
{
"image_id": "8c0f6a3e-2d1b-4f7a-9e5c-3b2a1d0e9f87",
"source": { "kind": "oci", "reference": "ghcr.io/acme/agent@sha256:4b7a..." },
"platform": "linux/amd64",
"state": "submitted"
}
Parameters
source.kindbodystringrequiredThe source type. Must be oci.
source.referencebodystringrequiredThe full image reference, pinned to a SHA-256 digest. Tags are rejected.
platformbodystringrequiredThe image platform. Must be linux/amd64.
envbodyobjectVariables to set over the image's own ENV in every machine made from it, as a Dockerfile
ENV line would. Values are literal, so $PATH is not expanded. At most 256 names and
64 KiB. Available through the HTTP API. The CLI and SDKs do not send it yet.
Wait until the image is ready
Dedalus prepares the image in the background. It downloads the image's layers, converts them into a machine root filesystem, and checks that the result can boot. Preparation takes longer for larger images and can take up to 30 minutes.
Check the progress of preparation by reading the image's state:
dedalus images retrieve --image-id <image_id>
image = client.images.retrieve(image_id="<image_id>")
print(image.state)
const image = await client.images.retrieve({ image_id: "<image_id>" });
console.log(image.state);
image, err := client.Images.Get(ctx, dedalus.ImageGetParams{
ImageID: imageID,
})
if err != nil {
return err
}
fmt.Println(image.State)
The image moves through these states:
submitted: Dedalus accepted the registration and queued it.preparing: Dedalus is preparing the image.context.stagenames the step (fetch,convert,validate, orpublish), andcontext.percentestimates how much of the preparation is done.stored_unvalidated: Dedalus converted the image and is about to validate it.ready: The image can launch machines.failed: Preparation failed. Theerrorfield describes the failure.rejected: Dedalus refused the image source. Theerrorfield says why.revoked: The image can no longer launch machines. Thereasonfield says why. Deleting an image moves it to this state.
Preparation ends in ready, failed, or rejected. If preparation fails, check the
preparation error to decide whether to fix the image or try again.
Start a new import with a new Idempotency-Key.
Launch a machine from an image
To launch a machine from a custom image, pass its image_id when you create the machine. The
image must be ready. The machine boots with your image as its root filesystem instead of the
Dedalus base image. Everything else about the machine works the same, including
lifecycle operations, executions, and
SSH.
dedalus machines create \
--vcpu 1 \
--memory-mib 4096 \
--storage-gib 10 \
--image-id <image_id>
machine = client.machines.create(
vcpu=1,
memory_mib=4096,
storage_gib=10,
image_id="<image_id>",
)
const machine = await client.machines.create({
vcpu: 1,
memory_mib: 4096,
storage_gib: 10,
image_id: "<image_id>",
});
machine, err := client.Machines.New(ctx, dedalus.MachineNewParams{
CreateParams: dedalus.CreateParams{
ImageID: dedalus.F[string](imageID),
Vcpu: dedalus.F[float64](1),
MemoryMib: dedalus.F[int64](4096),
StorageGib: dedalus.F[int64](10),
},
})
if err != nil {
return err
}
Parameters
image_idbodystringA ready custom image owned by your organization. Omit it to use the Dedalus base image.
List images
List returns the IDs of every image your organization has registered, including failed ones, but not deleted ones. Failed images count toward your image quota until you delete them, but a failed import that leaves no stored artifact doesn't count towards your limit, even before deletion. Retrieve an image by ID to read its state.
dedalus images list
images = client.images.list()
const images = await client.images.list();
images, err := client.Images.List(ctx, dedalus.ImageListParams{})
if err != nil {
return err
}
fmt.Println(len(images.ImageIDs))
Delete an image
Deleting an image frees its place in your image quota. Wait for an image to finish preparing before you delete it. Machines already running from the image keep running, but you cannot launch new machines from it.
dedalus images delete --image-id <image_id>
client.images.delete(image_id="<image_id>")
await client.images.delete({ image_id: "<image_id>" });
_, err := client.Images.Delete(ctx, dedalus.ImageDeleteParams{
ImageID: imageID,
})
if err != nil {
return err
}
The response is the image itself, now in state revoked. Here are its state fields:
{
"image_id": "8c0f6a3e-2d1b-4f7a-9e5c-3b2a1d0e9f87",
"state": "revoked",
"reason": "deleted by the organization"
}
A deleted image stays readable by its ID, so retrieving it returns the same revoked image. It no
longer appears in list results. Deleting it again returns the same image, so a
retried delete is safe. Launching a machine from it fails with IMAGE_ADMISSION_DISABLED.
Limits
Custom images are currently available only to Pro users.
Each organization can hold 10 images by default. Images that are ready, failed, or still
preparing count toward that quota. Deleted images and images that fail to import and leave no stored artifacts do not.
A single image can have at most 128 layers and 20 GiB of compressed layers. Its manifest and configuration can be at most 4 MiB each.
Errors
Registration errors
Registration errors return a JSON body with error_code, message, and retryable.
| Status | error_code | Meaning |
|---|---|---|
| 403 | IMAGE_PRO_REQUIRED | Your plan does not include custom images |
| 404 | RESOURCE_NOT_FOUND | No image with that ID belongs to your organization |
| 409 | IMAGE_ADMISSION_DISABLED | The image was rejected or revoked, for example by deleting it, so it cannot launch a machine |
| 409 | IMAGE_NOT_READY | The image is not ready, so it cannot launch a machine |
| 409 | IMAGE_QUOTA_EXCEEDED | Your organization reached its image quota |
| 422 | INVALID_REQUEST | The reference is not a pinned, supported image |
| 422 | IMAGE_PLATFORM_UNSUPPORTED | The platform is not linux/amd64 |
| 503 | IMAGE_CREDENTIALS_UNAVAILABLE | Private registries are not supported yet |
Preparation errors
Registration can succeed before preparation fails. When GET /v1/images/<image_id> returns
state: "failed", read the image's error object. It contains error_code, message,
retryable, and details.request_id, which is the image ID. Quote it when you contact support.
For example, an image with too many layers returns:
{
"state": "failed",
"error": {
"error_code": "IMAGE_SOURCE_INVALID",
"message": "The image source was rejected: image exceeds 128 layers.",
"retryable": false,
"details": { "request_id": "01a2..." }
}
}
With retryable: false, correct the image or its source before importing again. With
retryable: true, another attempt may succeed. A failed image does not restart automatically.
Start a new import with a new idempotency key when you are ready to retry.
error_code | message | What to do |
|---|---|---|
IMAGE_SOURCE_INVALID | "The image source was rejected: reason." | Fix what the reason names, such as the manifest, layer count, or archive layout. |
IMAGE_SOURCE_INVALID | "The image's layers could not be unpacked." | Rebuild the image and check its layers. |
IMAGE_SOURCE_UNAVAILABLE | "The image could not be fetched from its source. Check the reference and digest, or the uploaded archive, then register again." | Check the reference, the linux/amd64 manifest digest, and public access, then try again. |
IMAGE_ARCHIVE_UNAVAILABLE | "The uploaded archive could not be read. Upload it again, then register." | Upload the Docker tar file again, then register. |
IMAGE_EXECUTION_FAILED | "Image preparation failed. Register again with a new idempotency key." | Try again. If it keeps failing, contact support with the request ID. |
