Quicksand Image Tools
This package provides development tools for building custom VM images for the quicksand agent harness.
Installation
pip install quick-sandbox
quicksand install dev
CLI Usage
The recommended way to build custom images:
# Initialize a build directory (creates Dockerfile, builds base image if needed)
quicksand-image-tools init ./my-image ubuntu # or: alpine
# Customize the generated Dockerfile, then build the VM image
quicksand-image-tools build-image ./my-image/Dockerfile -o my-image.qcow2
Example Dockerfile
After running quicksand-image-tools init ./my-image ubuntu, a Dockerfile is created with the versioned base image. Add your customizations:
FROM quicksand/ubuntu-base:24.04.0
# Add your customizations here
RUN apt-get update && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/*
The base images include the kernel, agent, and init configuration. You just add your packages.
Python API
Build a VM image programmatically:
import asyncio
from quicksand_image_tools import build_image
from quicksand import Sandbox, SandboxConfig
async def main():
# Build from a Dockerfile path
image_path = build_image("./Dockerfile")
# Use the custom image
async with Sandbox(SandboxConfig(image_path=str(image_path))) as sb:
result = await sb.execute("node --version")
print(result.stdout)
asyncio.run(main())
Dockerfile Requirements
When building FROM a base image (quicksand/ubuntu-base or quicksand/alpine-base), you just add your packages - the base handles everything else.
For scratch Dockerfiles, you must:
- Install a kernel: Ubuntu
linux-image-virtualor Alpinelinux-virt - Build the Rust agent via multi-stage Docker build
- Configure a systemd service or OpenRC script to run the agent on boot
See the examples/custom_image.py for a complete working example.
CLI Reference
quicksand-image-tools init [directory] [ubuntu|alpine]
Initialize a directory for building custom images.
- If no Dockerfile exists in the directory, you must specify a base image type (
ubuntuoralpine) - Automatically builds the base Docker image if it doesn't exist
- Creates a Dockerfile with the appropriate
FROMstatement
quicksand-image-tools build-base [ubuntu|alpine|all]
Build base Docker images locally. Creates versioned images (e.g., quicksand/ubuntu-base:24.04.0) and tags them as latest. The version matches the installed quicksand-ubuntu or quicksand-alpine package version.
quicksand-image-tools build-image <dockerfile> [-o output] [--cache-dir dir]
Build a VM image from a Dockerfile.
Python API Reference
build_image(dockerfile, output_path=None, cache_dir=None)
Build a VM image from a Dockerfile.
dockerfile: Path to a Dockerfileoutput_path: Where to save the qcow2 image (default: cached by hash)cache_dir: Cache directory (default:~/.cache/quicksand/images/)
Returns the Path to the built qcow2 image.
get_agent_source_dir()
Returns the Path to the Rust agent source directory (quicksand-guest-agent/). This is used by image packages to set up symlinks for Docker builds.
How It Works
- Builds a Docker image from your Dockerfile
- Creates a container and exports its filesystem
- Extracts kernel and initrd from
/boot - Converts the filesystem to a bootable qcow2 VM image
Requirements
- Docker must be installed and running
- QEMU tools (bundled with quicksand-core, or install separately)
License
MIT
Metadata
Release files for quicksand-image-tools 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| quicksand_image_tools-0.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / quicksand_image_tools-0.6.1-py3-none-any.whl
| Download URL | quicksand_image_tools-0.6.1-py3-none-any.whl |
|---|---|
| Size | 56.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83053490fdc16ad340574d1ec99b1c158f35eeeed6b6b35a34ef46a079be9eb5
|
|
BLAKE2b-256 checksum How to use checksums |
8544d9952cc85ad96cff7a1c28820afb266f89976db427c613c1add2eb74e83d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|