---
url: /en/artifact/docker-model.md
description: >
  Guide for logging in, pushing, and pulling AI model artifacts from the CNB
  Docker Model Registry, including artifact path naming rules and CI pipeline
  usage.
---
## Login

Use your CNB access token to log in.
Refer to [Creating an Access Token](./intro.md#creating-an-access-token) for obtaining `CNB_TOKEN`.

```bash
docker login -u cnb -p <YOUR_TOKEN> docker-model.cnbprod.alpha.qq.com
```

> **Note**: The Docker Model registry only accepts Docker Model artifacts.
> Pushing other artifact types such as container images or Helm Charts
> to the Docker Model registry address will be rejected. Ensure the push target
> matches the artifact type
> (see [Artifact Type Admission Restrictions](./intro.md#artifact-type-admission-restrictions)).

## Artifact Path Rules

When publishing artifacts to a repository, two naming rules are supported:

* **Same-name artifacts**: Artifact path matches repository path,
  e.g. `docker-model.cnbprod.alpha.qq.com/${CNB_REPO_SLUG_LOWERCASE}`
* **Different-name artifacts**: Repository path serves as namespace,
  artifact path = repository path/artifact name,
  e.g. `docker-model.cnbprod.alpha.qq.com/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>`

## Pushing Artifacts

### Local CLI

```bash
docker model package --gguf model_file_path \
  --push docker-model.cnbprod.alpha.qq.com/${CNB_REPO_SLUG_LOWERCASE}:latest

# non-same-name artifact
docker model package --gguf model_file_path \
  --push docker-model.cnbprod.alpha.qq.com/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latest
```

### Cloud Native Build

Example for pushing a same-name artifact:

```yaml title=".cnb.yml"
main:
  push:
    - services:
        - docker
      stages:
        - name: docker model package & push
          # model_file_path is the model file path, e.g. ./model.gguf
          # <tag> is the artifact version, e.g. latest or a specific version
          script: docker model package --gguf model_file_path --push ${CNB_DOCKER_MODEL_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:<tag>
```

For a different-name artifact, append `repository path/artifact name` to the path:

```bash
docker model package --gguf model_file_path --push ${CNB_DOCKER_MODEL_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:<tag>
```

### Workspaces

```bash
docker model package --gguf model_file_path \
  --push docker-model.cnbprod.alpha.qq.com/${CNB_REPO_SLUG_LOWERCASE}:latest

# non-same-name artifact
docker model package --gguf model_file_path \
  --push docker-model.cnbprod.alpha.qq.com/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latest
```

## Pulling Artifacts

```bash
docker model pull docker-model.cnbprod.alpha.qq.com/<ARTIFACT_PATH>:latest
```
