Skip to main content
Guide

Disk images

A disk image defines the root filesystem a sandbox boots from. Start from a prebuilt public image, build a custom image from OCI, or commit a running sandbox to a new image.

Disk images are sourced in three ways:

Public imageCustom imageCommitted image
SourcePrebuilt and maintained by the platform.Built by you from a remote OCI container image.Built by you from a running sandbox's filesystem at commit time.
Best forGetting started, or when a stock base OS or runtime is all you need.Baking dependencies into an image you already publish to a registry.Capturing setup that's easier to do interactively inside a sandbox than to script.
Referenced byName, via --disk.ID, via --disk-id.ID, via --disk-id.

Discover public disk images

Public disk images can be referenced via a simple name when creating a sandbox. To discover all public disk images that are available:

  1. In the ACA Sandboxes portal, open your sandbox group.
  2. Select Disk images in the left menu.
  3. Select the Public tab.
  4. Review the image names. These are the public images that will be accessible via the Public Disk Image dropdown when creating a sandbox.
echo "==> Public disk images (valid --disk values):"
aca sandboxgroup disk list-public

Build a disk image from a container image

Custom disk images are built from a remote OCI container image, so any dependencies baked into that image are available the moment a sandbox boots. To build a custom disk image:

  1. In the ACA Sandboxes portal, open your sandbox group.
  2. Select Disk images.
  3. Select + Create.
  4. Optionally add identifying Labels for the image.
  5. Enter the Base Image URL. This is the remote OCI image that your custom disk image will be built from. For example, docker.io/library/alpine:3.19.
  6. Configure authentication under Registry Authentication if the source registry is private.
  7. Select Create and wait for the image state to show Ready.
DISK_NAME="alpine-build-example-$RANDOM"

echo "==> Building custom disk image '$DISK_NAME' from alpine:3.19..."
aca sandboxgroup disk create --image docker.io/library/alpine:3.19 --name "$DISK_NAME"

List and inspect private disk images

Disk images you create through a remote registry or by committing from a running sandbox are private and scoped to your sandbox group. To view your private disk images:

  1. In the ACA Sandboxes portal, open your sandbox group.
  2. Select Disk images.
  3. Select the Private tab.
  4. Select a disk image row to open its details.
  5. Use filters or labels to find a specific image.
echo "==> Listing your private disk images:"
aca sandboxgroup disk list

echo "==> Get details for the first private disk image:"
DISK_IMAGE_ID=$(aca sandboxgroup disk list -o json | jq -r '.[0].id')
aca sandboxgroup disk get --id "$DISK_IMAGE_ID"

Boot a sandbox from a private disk image

Sandboxes booted from custom or committed images use the disk image ID (--disk-id), not a name.

  1. In the ACA Sandboxes portal, open your sandbox group.
  2. Select Disk images.
  3. Open the Private tab.
  4. Select + from the disk image row under the Actions column.
  5. Confirm CPU, memory, labels, and environment settings.
  6. Select Create.
echo "==> Booting sandbox from disk-id $DISK_IMAGE_ID..."
aca sandbox create --disk-id "$DISK_IMAGE_ID"

Commit a running sandbox

note

A sandbox is briefly paused while its filesystem is committed, and resumes once the disk image has been created.

You can also create a disk image by committing the filesystem of a running sandbox. This captures everything done at runtime, such as package installs, downloads, and generated files, so any sandbox booted from the resulting image starts with that state already in place.

  1. In the ACA Sandboxes portal, open your sandbox group.
  2. Select Sandboxes.
  3. Select the running sandbox that you would like to commit.
  4. In the top right corner, select the overflow menu ().
  5. Select Commit Image from the dropdown.
  6. Select Commit to commit the sandbox to a new disk image.
PRIMER_LABEL="disks-commit-primer-$RANDOM"
echo "==> Booting primer sandbox (default disk)..."
aca sandbox create --disk-id "$DISK_IMAGE_ID" --label name="$PRIMER_LABEL"

echo "==> Looking up primer sandbox ID by label..."
SANDBOX_ID=$(aca sandbox list -l name="$PRIMER_LABEL" -o json | jq -r '.[0].id')

echo "==> Priming: write /example.txt..."
aca sandbox exec --id "$SANDBOX_ID" -c "echo 'hello world!' >> /example.txt"

COMMITTED_DISK_NAME="committed-disk-image-$RANDOM"
echo "==> Committing primer sandbox to disk image '$COMMITTED_DISK_NAME'..."
COMMITTED_DISK_ID=$(aca sandbox commit --id "$SANDBOX_ID" --name "$COMMITTED_DISK_NAME" -o json | jq -r '.diskImage.id')
echo "==> Committed disk image id: $COMMITTED_DISK_ID"

Delete a disk image

A disk image can only be deleted after all dependent sandboxes and child (committed) disk images are deleted.

  1. In the ACA Sandboxes portal, open your sandbox group.
  2. Select Disk images.
  3. Select the Private tab.
  4. Locate the row of the disk image you'd like to delete, and select the bin under the Actions column.
  5. Confirm the deletion.
echo "==> Deleting the source sandbox..."
aca sandbox delete --id "$SANDBOX_ID" --yes

echo "==> Deleting the committed (child) disk image first..."
aca sandboxgroup disk delete --id "$COMMITTED_DISK_ID"

echo "==> Deleting the base disk image..."
aca sandboxgroup disk delete --id "$DISK_IMAGE_ID"