---
url: /examples/vm-image.md
---
# Run an agent in a VM with your own image

Build an image with your project's tools on your Mac, and run an agent in a [microVM](/run/vm.md) that boots it, without pushing the image to a remote registry. You end with the image in a registry on your Mac and the reviewer agent running on it. You need Docker and a Mac that runs VMs ([supported platforms](/run/vm.md#supported-platforms)).

## 1. Build the image

Write a `Dockerfile` that starts from the VM's base image and adds your tools, such as the PostgreSQL client:

```dockerfile
FROM ghcr.io/pandra-io/vm-base:2026.11.30
RUN apt-get update \
    && apt-get install -y --no-install-recommends postgresql-client \
    && rm -rf /var/lib/apt/lists/*
```

To build it:

```sh
docker build -t dev-image:1 .
```

## 2. Push it to a registry on your Mac

Pandra pulls a VM's image from a registry, and reaches one on `localhost` over plain HTTP. To start a registry on port 5001 and push the image to it:

```sh
docker run -d --name registry -p 5001:5000 registry:2
docker tag dev-image:1 localhost:5001/dev-image:1
docker push localhost:5001/dev-image:1
```

The registry uses port 5001 because macOS's AirPlay Receiver listens on port 5000.

## 3. Name the image for the agent

To boot the image in every VM run of the reviewer, once the agent is in your store, such as after `pandra pull github.com/pandra-io/pandra/examples/reviewer`:

```sh
pandra config set --agent github.com/pandra-io/pandra/examples/reviewer \
    vm.image localhost:5001/dev-image:1
```

## 4. Run the agent

```sh
pandra run github.com/pandra-io/pandra/examples/reviewer --backend vm \
    --headless --prompt "Run psql --version and reply with its output."
```

The run's `VM:` line names your image:

```text
...
  VM:       localhost:5001/dev-image:1, 4 CPUs, 4GiB memory
...
```

When you change the image, build and push it under a new tag, such as `dev-image:2`, and set `vm.image` again. A session that already exists keeps the disk it made from the old image.

[Learn more about images →](/run/vm.md#images)
