# `ContainerImage`

A container image reference (the OCI distribution reference), fully qualified: its registry, its repository in lower case, and a tag, a digest or both: `docker.io/library/nginx:1.27`.

[Software](types.md#software); not ordered; since Jadpo 0.1.0.

## Make one

Build one from its text, `ContainerImage("docker.io/library/nginx:1.27")`, which checks it: text that isn't one breaks `format`.

`text.parse(raw, as: ContainerImage)` reads one from its text; text that isn't one at all fails `malformed`, such as `nginx:1.27`, `library/nginx:1.27` or `docker.io/library/nginx`.

## Text, JSON and storage

`text.from` writes its canonical text, the one form `text.parse` reads back. JSON sends its canonical text as a string.

| Text | JSON |
|---|---|
| `docker.io/library/nginx:1.27` | `"docker.io/library/nginx:1.27"` |
| `ghcr.io/acme/shop-api@sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b` | `"ghcr.io/acme/shop-api@sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b"` |
| `localhost:5000/infra/web_app:v2.1.0-rc.1` | `"localhost:5000/infra/web_app:v2.1.0-rc.1"` |
| `registry.example.com:8443/a/b/c:latest@sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b` | `"registry.example.com:8443/a/b/c:latest@sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b"` |

It is stored in one column named for the field, of type `text`. `localhost:5000/infra/web_app:v2.1.0-rc.1` is stored as `'localhost:5000/infra/web_app:v2.1.0-rc.1'`.

## Shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `docker.io/library/nginx:1.27` | `docker.io/library/nginx:1.27` |
| `ghcr.io/acme/shop-api@sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b` | `ghcr.io/acme/shop-api@sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b` |
| `localhost:5000/infra/web_app:v2.1.0-rc.1` | `localhost:5000/infra/web_app:v2.1.0-rc.1` |
| `registry.example.com:8443/a/b/c:latest@sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b` | `registry.example.com:8443/a/b/c:latest@sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b` |

## Operations

It has the contract's own operations: `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. It isn't ordered, so `<` and sorting don't take it. [Every standard type meets one contract](../topics/every-standard-type-meets-one-contract.md) says how they work.
