Push image to Registry

The goal of this step is to push the locally build image to the container registry documentation. We are going to publish the image in the IBM Cloud Container Registry.

Install the IBM Cloud CLI

Install the IBM Cloud CLI so that you can run the IBM Cloud ibmcloud commands

For MacOS, run the following command:

curl -fsSL https://clis.cloud.ibm.com/install/osx | sh

For Linux™, run the following command:

curl -fsSL https://clis.cloud.ibm.com/install/linux | sh

For Windows™ 10 Pro, run the following command in PowerShell as an administrator:

iex(New-Object Net.WebClient).DownloadString('https://clis.cloud.ibm.com/install/powershell')

For WSL2 on Windows™, run the following command:

curl -fsSL https://clis.cloud.ibm.com/install/linux | sh

Verify the IBM Cloud CLI installation

ibmcloud help

ibmcloud help
NAME:
  ibmcloud - A command line tool to interact with IBM Cloud
  Find more information at: https://ibm.biz/cli-docs

USAGE:
  [environment variables] ibmcloud [global options] command [arguments...] [command options]

VERSION:

....

Installing IBM Cloud Container Registry CLI plug-in

ibmcloud plugin install container-registry

Create a namespace in the container registry

The following guide creates a namespace on the container registry via a terminal. Optionally, you can perform the same activity on the Container Registry dashboard

  • Log in to your IBM Cloud account

      ibmcloud login -a https://cloud.ibm.com
    

    ❗️ If you are using a federated ID (such as via IBM), you need to add the --sso

    target the resource group of your cluster

      ibmcloud target -g <RESOURCE GROUP>
    
  • Ensure that you’re targeting the correct IBM Cloud Container Registry region

      ibmcloud cr region-set eu-de
    
  • Choose a name for your namespace, and create that namespace. Use this namespace for the rest of the lab

      ibmcloud cr namespace-add lab-kube
    
  • Log your local container engine daemon into the IBM Cloud Container Registry

    Using docker:

      ibmcloud cr login --client docker
    

    Using podman:

      ibmcloud cr login --client podman
    
  • Choose a repository and tag by which you can identify the image. Use the same repository and tag for the rest of thie lab

    Using docker:

      docker tag kube-lab:1.0 de.icr.io/lab-kube/kube-lab:1.0
    

    using podman:

      podman tag kube-lab:1.0 de.icr.io/lab-kube/kube-lab:1.0
    
  • Push the image

    Using docker:

      docker push de.icr.io/lab-kube/kube-lab:1.0
    

    using podman:

      podman push de.icr.io/lab-kube/kube-lab:1.0
    
  • Verify that the image was pushed

      ibmcloud cr image-list