Docker Artifact Registry
About 448 wordsAbout 1 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.build -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.build/${CNB_REPO_SLUG_LOWERCASE} - Different-name artifacts: Repository path serves as namespace, artifact path = repository path/artifact name, e.g.:
docker.cnb.build/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>
Pushing Artifacts
Push from Local Command Line
Same-name artifacts
docker build -t docker.cnb.build/${CNB_REPO_SLUG_LOWERCASE}:latest .
docker push docker.cnb.build/${CNB_REPO_SLUG_LOWERCASE}:latestDifferent-name artifacts
docker build -t docker.cnb.build/${CNB_REPO_SLUG_LOWERCASE}/<IMAGE_NAME>:latest .
docker push docker.cnb.build/${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.build/<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: 64 GB
Maximum number of layers per image: 64
Maximum size of artifact metadata: 64 KB
Docker Registry V1 API is not supported. Please use Docker 20.10+ client.
If you encounter the following errors, please upgrade 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 Docker official documentation.