Docker Artifact Repository

# Log in to CNB Docker Artifact Repository

You can use CNB's access token as a login credential. The login command is:

docker login docker.cnb.cool -u cnb -p {token-value}

# Docker Artifact Path Rules

When an artifact is published to a repository, two naming rules are supported:

  1. Same-name artifact - The artifact path is consistent with the repository path, such as: docker.cnb.cool/{repository-path}
  2. Non-same-name artifact - The repository path serves as the namespace of the artifact, and the artifact path = repository-path/artifact name, such as: docker.cnb.cool/{repository-path}/{artifact-name}

# Push Artifact

# Push from Local Command Line

Same-name artifact:

docker build -t docker.cnb.cool/{repository-path}:latest .
docker push docker.cnb.cool/{repository-path}:latest

Non-same-name artifact:

docker build -t docker.cnb.cool/{repository-path}/{image-name}:latest .
docker push docker.cnb.cool/{repository-path}/{image-name}:latest

# Push in Cloud Native Build

main:
  push:
    - services:
        - docker
      stages:
        - name: docker login
          script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
        - 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}:latest

# Push in Workspace

Same-name artifact:

docker build -t docker.cnb.cool/{repository-path}:latest .
docker push docker.cnb.cool/{repository-path}:latest

Non-same-name artifact:

docker build -t docker.cnb.cool/{repository-path}/{image-name}:latest .
docker push docker.cnb.cool/{repository-path}/{image-name}:latest

# Using Artifacts

# Use in Command Line

docker pull docker.cnb.cool/{artifact-path}:latest

# ...

# Customize Cloud Native Build Environment




 




main:
  push:
    - docker:
        image: docker.cnb.cool/{artifact-path}:latest
      stages:
        - name: hello world
          script: echo "Hello World"

# Customize Cloud Native Development Environment




 




$:
  vscode:
    - docker:
        image: docker.cnb.cool/{artifact-path}:latest
      services:
        - vscode
        - docker

# More Usage

For more Docker usage, please refer to the official documentation.