Pushing and pulling images

You can push or pull images from your local file system to the private image registry.

Required user type or access level: Super adminstrator or Administrator

Prerequisites: You must install Docker on your computer. See Install Docker.

  1. If your Docker image is on a node that is outside of your cluster, set up authentication from that client node to the cluster.

    1. On the system that hosts the Docker image, add the following line to the /etc/hosts file.

      <master_ip> <cluster_CA_domain>

      Where <master_ip> is the IP address of the master host in your cluster, and <cluster_CA_domain> is the certificate authority (CA) domain that was set in the config.yaml file during installation. If you did not specify a CA domain name, the default value is mycluster.icp. See Specifying your own certificate authority (CA) for IBM® Cloud Private services.

    2. On your client node, create a directory to store the docker registry certificate.

      mkdir /etc/docker/certs.d/<cluster_CA_domain>:8500/
    3. From the master node of your IBM® Cloud Private cluster, secure copy the registry certificate to the client node.

      scp /etc/docker/certs.d/<cluster_CA_domain>\:8500/ca.crt \
  2. If your cluster uses a high availability architecture, ensure that you mount a shared directory under /var/lib/registry.

  3. Log in to your private image registry.

    docker login <cluster_CA_domain>:8500
  4. Push or pull the required image. A namespace name is required when you push or pull images. For more information about namespaces, see Namespaces.

    • To push an image from your local file system to your private image registry, run the following commands:

      1. Tag the image.

        docker tag image_name:tagname <cluster_CA_domain>:8500/namespacename/imagename:tagname
      2. Push the image to the private image registry.

        docker push <cluster_CA_domain>:8500/namespacename/imagename:tagname
    • To pull an image from your private image registry to your local file system, run the docker pull command.

       docker pull <cluster_CA_domain>:8500/namespacename/imagename:tagname
  5. (Optional) Deploy an application or job by using the newly added image. For more information on deploying applications and jobs, see Deploying applications and jobs.