
Vary also ships as a Docker image. No JDK or system-level install required.

## Pull the image

```bash
docker pull ghcr.io/ccollicutt/vary:latest
```

## Set up the alias

Add this to your `~/.bashrc` or `~/.zshrc`:

```bash
alias vary='docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workspace" -w /workspace ghcr.io/ccollicutt/vary:latest'
```

Reload your shell (`source ~/.bashrc` or open a new terminal) and verify:

```bash
vary --version
```

This prints something like `vary vN (build XXXX)`. After this, `vary` works like any other command on your machine.

## How it works

The Vary compiler lives inside the Docker image, but you write `.vary` files on your local machine. The `-v "$(pwd):/workspace"` flag mounts your current directory into the container so the compiler can see your files.

| Flag | What it does |
|------|-------------|
| `docker run` | Start a new container from the image |
| `--rm` | Remove the container after it exits |
| `-u "$(id -u):$(id -g)"` | Run as your user so created files are owned by you, not root |
| `-v "$(pwd):/workspace"` | Mount your current directory into `/workspace` inside the container |
| `-w /workspace` | Set the container's working directory to `/workspace` |
| `ghcr.io/ccollicutt/vary:latest` | The Vary image to run |

## Using without an alias

For CI pipelines, scripts, or environments where shell aliases aren't available:

```bash
docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workspace" -w /workspace ghcr.io/ccollicutt/vary:latest run hello.vary
```

## Other container runtimes

The image is a standard OCI container. Podman, nerdctl, Colima, or anything else that can pull and run OCI images should work:

```bash
alias vary='podman run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/workspace" -w /workspace ghcr.io/ccollicutt/vary:latest'
```

## Next steps

See [Getting started](/docs/getting-started/) for your first program, or [VS Code + Dev Container](/docs/vscode/) for a full IDE experience.
