A.2 Push App Image to a Remote Repo

Push the Docker image of the applications, that you have built, to a remote repository.

The container image that you have built is available in your local repository. You must push this image to a remote repository, so that you can access this image using Helm. Later, you will use Helm to install your application.

If you are using Oracle Cloud Infrastructure Registry, see Push an Image to Oracle Cloud Infrastructure Registry. If you are using other Kubernetes platforms, use the instructions provided in this section.

Before you begin, complete the following tasks:
  • Identify a remote private repository to which you want to upload the container image. You can create a new remote Docker repository or use an existing one. Use a private repository to limit access. When you use a remote Docker repository, you have to push images to the remote Docker repository only once, while you can pull an image multiple times onto any Kubernetes cluster that you create.
  • Create a Kubernetes secret to access the remote Docker repository. See Create a Kubernetes Secret to Access Docker Registry.
  1. Provide credentials to log in to the remote private repository to which you want to push the image.
    docker login <repo>

    Provide the login credentials based on the Kubernetes platform that you are using.

  2. In your local container registry, identify the tag of the image that you want to push.

    Skip this step if you have noted the tag of this image.

    1. Run the following command to list the Docker images.
      docker images
    2. Copy the tag of the image that you want to push. You'll need to provide this information later.
  3. Use the following command to specify a unique tag for the image that you want to push to the remote Docker repository.

    Syntax

    docker tag local_image_tag remote_image_tag

    Where,

    • local_image_tag is the tag with which the image is identified in your local repository.
    • remote_image_tag is the tag with which you want to identify the image in the remote Docker repository.

    Example Command

    docker tag myApp123 <region-key>.ocir.io/otmmrepo/myApp123

    Where, <region-key>.ocir.io/otmmrepo is the Oracle Cloud Infrastructure Registry to which you want to push the image file, myApp123. If you are using other Kubernetes platforms, then provide the registry details based on your environment.

  4. Push the Docker image from your local repository to the remote Docker repository.

    Syntax

    docker push remote_image_tag
    Example Command
    docker push <region-key>.ocir.io/otmmrepo/myApp123

Note down the tag of the Docker image in the remote Docker repository. You'll need to enter this tag while pulling the image from the remote Docker repository.