# Store container images

Your team has a private container registry at `registry.liveterminal.ai`. Images live under your
team's registry name:

```text
registry.liveterminal.ai/<name>/<repo>:<tag>      for example registry.liveterminal.ai/acme/app:1
```

You use it with the normal Docker client, from your VPS or any other machine.

## 1. Pick the registry name (once)

An owner sets the name once; it can't be changed later.

```sh
lt registry name set acme
lt registry show        # NAME, ADDRESS, STORED, QUOTA, MEASURED
```

The name is 2 to 39 lowercase letters, digits and single hyphens, starting and ending with a
letter or digit. A name another team already has is refused.

## 2. Log in

Docker logs in with a LiveTerminal API token as the password. Make one that can only pull and
push images, and hand it straight to Docker:

```sh
lt auth token create --name docker --scope registry.pull,registry.push --expires-days 30 \
  | docker login registry.liveterminal.ai -u lt --password-stdin
```

- `lt auth token create` prints only the token on stdout, so it goes into Docker and not onto your
  screen. Docker stores it in `~/.docker/config.json`.
- The user name is not checked; `lt` is fine.
- A token lasts at most 90 days. When it expires, run the same command again.
- For a machine that only pulls, use `--scope registry.pull`: pushing with it is refused.
- On a VPS, a token needs a signed-in person: run `lt auth login` there first. The VPS's own
  identity can't make tokens.

## 3. Push and pull

Build on your VPS (or anywhere with Docker), tag the image with your registry name, and push:

```sh
docker build -t registry.liveterminal.ai/acme/app:1 .
docker push registry.liveterminal.ai/acme/app:1
```

Any machine logged in with a token of your team pulls it:

```sh
docker pull registry.liveterminal.ai/acme/app:1
```

## Who can do what

| Role  | Pull | Push | Set the name |
| ----- | ---- | ---- | ------------ |
| read  | yes  | no   | no           |
| write | yes  | yes  | no           |
| owner | yes  | yes  | yes          |

A token never does more than its scopes, nor more than your role allows right now. Images of
another team can't be pulled or pushed with your token.

## Space

`lt registry show` shows how much your images use (measured about every hour) and your team's
quota. At or over the quota, a push is refused; pulling keeps working.

## Not offered yet

- Deleting an image or a tag.
- A list of your repositories.
- Pulling these images in a LiveTerminal CI job
  ([Run your GitLab CI jobs on LiveTerminal](/ci-gitlab/)).