Docker Artifact Registry
About 297 wordsLess than 1 minute
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
More Usage
For more Docker usage, please refer to the official documentation