Docker Artifact Registry
About 455 wordsAbout 2 min
Login to CNB Docker Artifact Registry
You can use CNB access token as login credentials. For how to get CNB_TOKEN, please refer to Creating an Access Token. Login command:
docker login docker.cnb.cool -u cnb -p <YOUR_TOKEN>Docker 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.cnb.cool/${CNB_REPO_SLUG_LOWERCASE} - Different-name artifacts - Repository path serves as namespace for artifacts, artifact path = repository path/artifact name, e.g.:
docker.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>
Pushing Artifacts
Push from Local Command Line
Same-name artifacts
docker build -t docker.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}:latest .
docker push docker.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}:latestDifferent-name artifacts
docker build -t docker.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latest .
docker push docker.cnb.cool/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latestPush in Cloud Native Build
main:
push:
- services:
- docker
stages:
- name: docker build
script: docker build -t ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest .
- name: docker push
script: docker push ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latestPush in Workspaces
Same-name artifacts
docker build -t ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest .
docker push ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latestDifferent-name artifacts
docker build -t ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latest .
docker push ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latestUsing Artifacts
Use in Command Line
docker pull docker.cnb.cool/<ARTIFACT_PATH>:latestCustomize Cloud Native Build Environment
main:
push:
- docker:
image: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest
stages:
- name: hello world
script: echo "Hello World"Customize Workspaces Environment
$:
vscode:
- docker:
image: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest
services:
- vscode
- dockerLimitations
Maximum quota per layer: 64GB
Maximum number of layers per image: 64
Maximum size of artifact metadata: 64KB
Docker Registry V1 API is not supported. Please use Docker 20.10+ client. Older versions (e.g. 1.13.1), while supporting V2, will generate both V1 and V2 endpoints for non-Docker Hub registries by default and automatically fall back to V1 when V2 requests fail, causing requests to be rejected. If you encounter the following errors, please upgrade your Docker version:
Error: image <IMAGE_NAME> not foundFailed to pull image: rpc error: code = Unknown desc = missing signature keyIf you must use an older version of Docker (below 17.12), you need to manually disable the V1 protocol:
Configuration Platform Default Description dockerd --disable-legacy-registryLinux falseDisable V1 via startup parameter Set "disable-legacy-registry": trueindaemon.jsonAll platforms Not set Disable V1 via config file Note: Windows/macOS platforms automatically enforce V2 protocol, no additional configuration needed. This option was removed in Docker 17.12+ as V1 support was completely dropped.
More Usage
For more Docker usage, please refer to the official documentation