+

Search Tips  |   Advanced Search


IBM Cloud Container Registry

IBM Cloud Container Registry provides a multi-tenant private image registry that you can use to store and share your container images with users in your IBM Cloud account.

The IBM Cloud console includes a brief Quick Start. To find out more about how to use the IBM Cloud console, see Managing image security with Vulnerability Advisor.

Do not put personal information in your container images, namespace names, description fields, or in any image configuration data (for example, image names or image labels).


Step 1: Install the IBM Cloud Container Registry CLI

  1. Install the IBM Cloud CLI so that you can run the IBM Cloud ibmcloud commands, see Getting started with the IBM Cloud CLI. This installation also installs the CLI plug-ins for IBM Cloud Kubernetes Service and IBM Cloud Container Registry.


Step 2: Set up a namespace

Create a namespace. The namespace is created in the resource group specified so that you can configure access to resources within the namespace at the resource group level. If you don't specify a resource group, and you don't target a resource group, the default resource group is used.

  1. Log in to IBM Cloud.

    ibmcloud login

    If you've a federated ID, use ibmcloud login --sso to log in. Enter your username and use the provided URL in your CLI output to retrieve your one-time passcode. If you've a federated ID, the login fails without the --sso and succeeds with the --sso option.

  2. Add a namespace to create your own image repository. Replace <my_namespace> with your preferred namespace.

    The namespace must be unique across all IBM Cloud accounts in the same region. Namespaces must have 4 - 30 characters, and contain lowercase letters, numbers, hyphens (-), and underscores (_) only. Namespaces must start and end with a letter or number.

    We can put the namespace in a resource group of your choice by either running ibmcloud target -g <resource_group> before you create the namespace, where <resource_group> is the resource group, or by specifying the required resource group by using the -g option on the ibmcloud cr namespace-add command.

    ibmcloud cr namespace-add <my_namespace>

  3. To ensure that your namespace is created, run the ibmcloud cr namespace-list command.

    ibmcloud cr namespace-list -v


Step 3: Pull images from another registry to your local computer

  1. Install the Docker Engine CLI. For Windows 8, or OS X Yosemite 10.10.x or earlier, install Docker Toolbox instead. IBM Cloud Container Registry supports Docker Engine v1.12.6, or later.

  2. Download (pull) the image to your local computer. Replace <source_image> with the repository of the image and <tag> with the tag of the image that you want to use, for example, latest.

    docker pull <source_image>:<tag>

    Example, where <source_image> is hello-world and <tag> is latest:

    docker pull hello-world:latest

  3. Tag the image. Replace <source_image> with the repository and <tag> with the tag of your local image that you pulled earlier. Replace <region> with the name of your region. Replace <my_namespace> with the namespace that you created in Step 2, see Set up a namespace. Define the repository and tag of the image that you want to use in your namespace by replacing <new_image_repo> and <new_tag>.

    docker tag <source_image>:<tag> <region>.icr.io/<my_namespace>/<new_image_repo>:<new_tag>

    To find the name of your region, run the ibmcloud cr region command.

    Example, where <source_image> is hello-world, <tag> is latest, <region> is uk, <my_namespace> is namespace1, <new_image_repo> is hw_repo, and <new_tag> is 1:

    docker tag hello-world:latest uk.icr.io/namespace1/hw_repo:1


Step 4: Push Docker images to your namespace

  1. Run the ibmcloud cr login command to log your local Docker daemon into IBM Cloud Container Registry.

    ibmcloud cr login

  2. Upload (push) the image to your namespace. Replace <my_namespace> with the namespace that you created in Step 2, see Set up a namespace, and <image_repo> and <tag> with the repository and the tag of the image that you chose when you tagged the image.

    docker push <region>.icr.io/<my_namespace>/<image_repo>:<tag>

    Example, where <region> is uk, <my_namespace> is namespace1, <image_repo> is hw_repo, and <tag> is 1:

    docker push uk.icr.io/namespace1/hw_repo:1

  3. Verify that the image was pushed successfully by running the following command.

    ibmcloud cr image-list

You set up a namespace in IBM Cloud Container Registry and pushed your first image to your namespace.


Next steps