# Templates A template sets the system, files and size of a sandbox. Use a ready one, or build your own from a Dockerfile. ## Ready templates With no name, `Sandbox.create()` and `fdtn create` use `base`. | Template | Size | Free disk | Price | What is inside | |---|---|---|---|---| | `base` | 2 vCPU, 512 MiB | 5 GiB | $0.039/h | Debian 12, Python 3.11, Node.js 20, git, curl | | `small` | 2 vCPU, 512 MiB | 5 GiB | $0.039/h | Ubuntu 24.04, Python 3.12, git | | `claude` | 2 vCPU, 2 GiB | 20 GiB | $0.048/h | Debian, Node.js 24, Python 3, Claude Code, git, ripgrep. Runs on our own machines. [Coding agents](https://fdtn.dev/docs/coding-agents.md) | Coding agents also come in larger sizes: `claude`, `codex` and `opencode` with `-2vcpu-4gib`, `-4vcpu-8gib` or `-8vcpu-16gib` (for example `claude-4vcpu-8gib`). Every coding-agent template has 20 GiB of disk. Only plain `claude` stays on our own computers; for a sized one, add `--trusted` or metadata `fdtn_own_fleet_only=1`. The Templates page in the [portal](https://compute.fdtn.dev) shows the current list. Install more tools at run time with `pip`, `npm` or `apt-get` (as `root`). For large installs, build a template with more memory. An unknown template name fails with `404`. `fdtn template ls` lists your templates. A build is free. At a spending limit, new builds stop ([Limits](https://fdtn.dev/docs/limits.md)). You do not need Docker. ## 1. Write a Dockerfile Save as `Dockerfile` in an empty folder: (Dockerfile): ``` FROM python:3.13-slim-bookworm RUN pip install --no-cache-dir pandas WORKDIR /app ``` - `fdtn` reads `fdtn.Dockerfile` first, then `Dockerfile`. - `FROM` images come from docker.io, ghcr.io or quay.io. - Use an image with an arm64 build, such as the official Python, Node.js, Debian and Ubuntu images. ## 2. Build the template ```bash $ fdtn template create my-app Using ./Dockerfile Building template my-app... ... Template my-app is ready. Start a sandbox from it with: fdtn create my-app ``` The first build takes a minute or more. Later builds cache unchanged steps. If a step fails, fix it and run again ([errors](https://fdtn.dev/docs/troubleshooting.md#templates)). | Option | What it does | |---|---| | `-d` | Dockerfile path | | `--cpu-count` | vCPU, default 2 | | `--memory-mb` | Memory, default 1024 | | `--cmd`, `--ready-cmd` | Start command and its ready check | An existing name rebuilds that template. [All options](https://fdtn.dev/docs/cli.md#templates) ```bash $ fdtn template create web --cmd "node /app/server.js" --ready-cmd "curl -sf http://localhost:3000" ``` Names: lowercase letters, numbers, dashes and underscores, up to 128 characters. After Ctrl-C, the build can still finish. ## 3. Check the template ```bash $ fdtn template list ``` Start sandboxes only when the build is ready. ## 4. Start a sandbox from it Python: ```python from fdtn import Sandbox sbx = Sandbox.create("my-app", request_timeout=120) print(sbx.commands.run("python -c 'import pandas; print(pandas.__version__)'").stdout) sbx.kill() ``` TypeScript: ```typescript import { Sandbox } from '@fdtn/sdk' const sbx = await Sandbox.create('my-app', { requestTimeoutMs: 120_000 }) console.log((await sbx.commands.run("python -c 'import pandas; print(pandas.__version__)'")).stdout) await sbx.kill() ``` CLI: ```bash $ fdtn create my-app ``` The first start on a computer can take up to a minute. Later starts take less than 500 ms. ## Sizes For another size, build another template. | Resource | Choices | Default | |---|---|---| | vCPU | 1 to 16 | 2 | | Memory | Up to 32 GiB, in 512 MiB blocks | 1 GiB | | Disk | Free. 5 GiB up to 512 MiB memory, 10 GiB up to 2 GiB, else 20 GiB. | 10 GiB | Prices: [Pricing](https://fdtn.dev/docs/pricing.md#sizes). A large size can wait in the queue until a computer has its memory free. ## Build from code Python (build.py): ```python from fdtn import Template template = ( Template() .from_image("python:3.13-slim-bookworm") .run_cmd("pip install --no-cache-dir pandas") ) Template.build(template, "my-app", cpu_count=2, memory_mb=4096) ``` TypeScript (build.mjs): ```typescript import { Template } from '@fdtn/sdk' const template = Template() .fromImage('python:3.13-slim-bookworm') .runCmd('pip install --no-cache-dir pandas') await Template.build(template, 'my-app', { cpuCount: 2, memoryMB: 4096 }) ``` `fdtn template init -n my-app -l python-sync` makes a starter folder with build scripts. Run the commands it prints; `fdtn template create` reads only Dockerfiles. ## Delete a template ```bash $ fdtn template delete my-app # asks first $ fdtn template delete a b --yes # no question, for scripts ``` ## Limits - `COPY` uploads: 1 GiB each (413), 10 GiB per workspace per UTC day (429). Download large files in a `RUN` step. - Build logs: `fdtn template build logs `. `fdtn template create` prints both IDs. ## Next - [**Pricing**: Rates and worked examples.](https://fdtn.dev/docs/pricing.md) - [**Many sandboxes**: Start a group from one.](https://fdtn.dev/docs/parallel.md) Source: https://fdtn.dev/docs/templates/