> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anonalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# anona-compute template build

> Build a template from a Dockerfile

```text theme={null}
Builds a template from a Dockerfile and a build context (default: the
current directory), streaming the build log. The gateway builds it with
BuildKit in an isolated builder, adds the Anona runtime (envd), pushes it and
registers it; sandboxes then start from it by name:

  anona-compute template build -f Dockerfile --name my-env
  anona-compute create -t my-env

Every FROM image is pinned by digest. EXPOSE 49983 (envd) is refused. The
image's CMD runs at sandbox start only when the last stage declares CMD or
ENTRYPOINT, or with --start-cmd. .dockerignore in the context is honored.
```

## Usage

```text theme={null}
anona-compute template build [CONTEXT_DIR] [flags]
```

## Flags

| Flag | Type | Description |
| - | - | - |
| `--cpu` | int | vCPUs of sandboxes from this template (default 2) |
| `--file`, `-f` | string | Dockerfile (default CONTEXT\_DIR/Dockerfile) |
| `--help`, `-h` | | help for build |
| `--memory` | int | memory of sandboxes from this template, MiB (default 2048) |
| `--name`, `-n` | string | template name (default: the context directory's name) |
| `--no-cache` | | build without the build cache |
| `--start-cmd` | string | command to run when a sandbox starts (after envd) |
| `--tag` | stringArray | tag for this build (repeatable) |
| `--wait` | | stream the build log and wait until it is ready (--wait=false returns at once) (default true) |

Global flags (`--api-key`, `--api-url`, `--json`, `--output`, `--profile`, `--request-timeout`, `--verbose`) work on every command; see [anona-compute](https://docs.anonalabs.com/compute/cli/reference/anona-compute.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.