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.2
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 | Actions Reset |
|---|---|---|---|---|
| quicksand_image_tools-0.6.2-py3-none-any.whl | Python 3 | none | any | Details for quicksand_image_tools-0.6.2-py3-none-any.whl |
Release files / quicksand_image_tools-0.6.2-py3-none-any.whl
| Download URL | quicksand_image_tools-0.6.2-py3-none-any.whl |
|---|---|
| Size | 65.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15011a3ae35e4cebe383814b6a9889566569d27b9b85e1d61dc27ae73994d6d2
|
|
BLAKE2b-256 checksum How to use checksums |
f03d4671196d52ff69fb9f3371e17fa8354edb962d8d94774a62a8a1a34d8866
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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}
|
Security for quicksand-image-tools 0.6.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.