# Container registry

> For AI agents: the complete documentation index is at https://buddy.works/llms.txt

Push and pull Docker images to a private registry at container.registry.sh. Each image tag becomes a version of a Container Image artifact in Buddy.

A Container Image artifact is a private Docker image registry at `container.registry.sh`. You push and pull images with the regular `docker` client, and each tag appears in Buddy as an artifact version.

## How do I address an image in the registry?

The image address has the form `container.registry.sh/<workspace>/<artifact>:<tag>`. It contains only the workspace and the artifact identifier, even when the artifact belongs to a project.

```
container.registry.sh/my-workspace/my-app-image:1.0.0
```

### Creation in the UI

You create the artifact in the UI, from the CLI or with the first `docker push` to a new name.

### Creation using the CLI

In the project sidebar, open **Artifacts**, click **New artifact** and select **Container Image**.

![Artifact types in the New artifact menu](https://buddy.works/docs/artifacts/new-artifact-types.png)

### Create a Container Image artifact from the CLI

```bash
bdy artifact create my-app-image -t CONTAINER -b -p my-project
```

The `-b` flag turns on Buddy Auth. The other flags are described in the [CLI reference](https://buddy.works/docs/cli/artifact/create.md).

### Automatic artifact creation

`docker push` to a name that does not exist creates the artifact automatically. Such an artifact has the **Workspace** scope, even if you work in the context of a project.

> **Warning**
>
> An artifact created by `docker push` is available at the Workspace scope. Version creation can trigger pipelines configured with the [On artifact event](https://buddy.works/docs/pipelines/introduction/triggering-pipelines/on-artifact-event.md) trigger for all artifacts. An incorrect image reference may therefore trigger a pipeline in another project. Automatically created artifacts have the **Deny** permission level for pipelines by default. Such runs fail during setup, before the first action starts, and are recorded in the run history. To use the Project scope, create the artifact before pushing the first image.

## Log in to the registry

The `bdy artifact docker login` command logs the `docker` client in to the registry with the credentials of the logged-in `bdy` user:

```bash
bdy artifact docker login
```

After the `Login succeeded` message, `docker push` and `docker pull` work without a password. If `bdy` is not logged in yet, start with [Getting started with the CLI](https://buddy.works/docs/cli/getting-started.md).

### Log in without bdy

Where there is no `bdy`, e.g. on a server or in a third-party CI, the registry password is a [personal access token](https://buddy.works/docs/api/getting-started/oauth2/personal-access-token.md) with the **Artifacts** scope: the **Read** level is enough for `docker pull`, and `docker push` requires **Write**. The username can be anything:

```bash
echo "$REGISTRY_TOKEN" | docker login container.registry.sh -u token --password-stdin
```

Without login, the registry responds with `UNAUTHORIZED: authentication required`, even when you only fetch the list of tags.

## Push and pull an image

Tag the image with the full registry address and push it:

```bash
docker build -t container.registry.sh/my-workspace/my-app-image:1.0.0 .
docker push container.registry.sh/my-workspace/my-app-image:1.0.0
```

Pull on another machine, after `bdy artifact docker login`:

```bash
docker pull container.registry.sh/my-workspace/my-app-image:1.0.0
```

The **Versions** tab shows the full image address and its size next to each version.

![Container Image artifact versions](https://buddy.works/docs/artifacts/container-registry-versions.png)

A Container Image artifact has no **Browse** tab. On the artifact list, it shows a Docker icon instead of a download button.

## Can I overwrite a tag?

Yes. Another `docker push` with the same tag replaces the image in the version, and from then on the version has a new digest. In a Bucket artifact, publishing the same version again from the CLI requires the `-f` flag.

If a version must stay immutable, e.g. a production release, use single-use tags (`1.4.2`, `build-118`), and keep overwritable tags such as `latest` or `staging` for test environments.

## Give pipelines access to the images

A pipeline that runs an action on an image from the registry needs at least the **Read-only** level in the artifact's **Permissions** tab. If **All pipelines** has the **Deny** level, raise it or add the selected pipeline with the **+** button. Otherwise, the action returns `Pipeline is not allowed to use artifact: my-app-image [BE2810035]`.

![Pipeline entry with its own access level while All pipelines is set to Deny](https://buddy.works/docs/artifacts/artifacts-permissions-pipeline.png)

See also:

- [Using artifact images](https://buddy.works/docs/artifacts/using-artifact-images.md) - an image from the registry as the BUILD action environment and a service
- [Permissions and access](https://buddy.works/docs/artifacts/permissions-and-access.md) - access levels for pipelines, sandboxes and roles
- [Versions](https://buddy.works/docs/artifacts/versions.md) - version names and run history for a version
- [bdy artifact docker login](https://buddy.works/docs/cli/artifact/docker/login.md) - command reference
- [Push image](https://buddy.works/docs/actions/docker/push-docker-image.md) - pipeline action for pushing images


---
Original source: https://buddy.works/docs/artifacts/container-registry