---
title: BaseImage
description: "The platform's managed base image, paired with the Dockerfile FROM it goes with."
---

```python
@final
class BaseImage
```

The platform's managed base image, paired with the Dockerfile `FROM` it goes with.

One class rather than two strings, because the two **must** agree and used to be able
to disagree: the Python client's default named the managed base for `baseImageArn` while
its Dockerfile hardcoded an unrelated registry literal in its `FROM`, so changing either
left the other pointing somewhere else.

## Constructor

```python
BaseImage(name: str, docker_ref: str, working_dir: str = '')
```

A base a caller built themselves.

`working_dir` is what `docker inspect` reports for `WorkingDir`, and empty means the
image declares none. It is a parameter because a caller with a purpose-built image
is the only one who can say what theirs declares — this client cannot read it
without pulling the manifest. Getting it wrong is what
`inherit_workdir` refuses on.

## Properties

### `docker_ref`

```python
docker_ref: str
```

Goes into the Dockerfile `FROM` — the registry ref measured alongside `name`.

### `name`

```python
name: str
```

Goes into `baseImageArn` — the platform's managed base, not a registry ref.

### `working_dir`

```python
working_dir: str
```

## Methods

### `al2023`

```python
@staticmethod
def al2023() -> BaseImage
```

The managed Amazon Linux 2023 base used for measurements in `docs/PLATFORM.md`.

### `from_dockerfile`

```python
@staticmethod
def from_dockerfile(dockerfile: str) -> BaseImage
```

The base a task Dockerfile pairs with: the managed base's `name`, so `baseImageArn` is
unchanged, and the Dockerfile's first `FROM` as `docker_ref`, digest pin included.

`build_image` refuses a Dockerfile whose first `FROM` is not the base's `docker_ref`;
a base derived from that Dockerfile passes by construction. Raises `InvalidArgError`
for a Dockerfile with no `FROM`.

## Special methods

### `__repr__`

```python
def __repr__() -> str
```

## Provenance

This page is generated from `bindings/microvms-py/microvms.pyi` by Griffe 2.3.0, run from `site/scripts/gen-reference.mjs` on every `pnpm run sync`, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding's Rust source, then regenerate the declarations with `mise run stubs`. `mise run stubs:check` fails when the committed file no longer matches the source.