Docker Model Registry
About 348 wordsAbout 1 min
Docker Model Registry stores and distributes AI model artifacts, compatible with the docker model commands.
When to use: when you need to push models built locally or in a pipeline to CNB, or pull models from CNB for an inference service - log in and push/pull as shown below.
Login
Use your CNB access token to log in. Refer to Creating an Access Token for obtaining CNB_TOKEN.
docker login -u cnb -p <YOUR_TOKEN> oci.cnb.coolNote
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).
Artifact Path Rules
When publishing artifacts to a repository, two naming rules are supported:
- Same-name artifacts: Artifact path matches repository path, e.g.
oci.cnb.cool/${CNB_REPO_SLUG_LOWERCASE} - Different-name artifacts: Repository path serves as namespace, artifact path = repository path/artifact name, e.g.
oci.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>
Pushing Artifacts
Local CLI
docker model package --gguf model_file_path \
--push oci.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}:latest
# non-same-name artifact
docker model package --gguf model_file_path \
--push oci.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latestCloud Native Build
Example for pushing a same-name artifact:
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:
docker model package --gguf model_file_path --push ${CNB_DOCKER_MODEL_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:<tag>Workspaces
docker model package --gguf model_file_path \
--push oci.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}:latest
# non-same-name artifact
docker model package --gguf model_file_path \
--push oci.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latestPulling Artifacts
docker model pull oci.cnb.cool/<ARTIFACT_PATH>:latest