What is OCIR:
Oracle Cloud Infrastructure Registry, or a container registry, is an Oracle-managed registry that enables you to simplify your development to production workflow.
OCIR is best used to store Docker images you will utilize in Containerized Applications, such as those that you deploy with Container Engine for Kubernetes.
In this blog, post I will show you
1. How to create an OCIR Repository
2. How to push docker Image to OCIR Repository
3. How to pull Images from OCIR Repository

1. How to Create the repository in OCIR
Go to OCI Menu –> Developer Services –> Container & Artifacts –> Container Registry

Click on Create Repository, give it a name, and click on Create

It will create a private repository (You can also create a public)

2. How to Push Docker Image to OCIR repository:
To push an image first we have to generate an Auth token, Generate Auth token
Click on the profile menu –> user settings –> Click on Auth Tokens
Click on Generate Token –> Give any description and click on Generate token

You will see the screen below

Copy and save this token somewhere.
Now to push the docker image to the OCIR repository, we need a docker environment.
Either you can use docker from your machine if OCI setup is there or else the easiest way is to use OCI Cloud Shell, OCI Cloud Shell already has docker installed.
Click on developer tool –> Cloud shell

I will log in to the container registry using the docker login command
docker login <region_key>.ocir.io
Where,
<region-key> is the key for your Oracle Cloud Infrastructure Registry region. For example, YYZ is the region key for Canada Southeast (Toronto) region.
See the Availability by Region topic in the Oracle Cloud Infrastructure documentation.
username = tenancy-namespace/your username
password = Auth token we generated above

Now time to push my local image into the container registry, first check what local images present in this machine. To push the local image to the container registry I need to Tag the source image first

here is the above tag command we have to give the full path of the container target repository where we want to push the image
i.e. <region-key>/tenancy namespace>/OCIR Repository Name
Now check if a new image was created with a new tag and then push the image into the container registry

Now check the console for the OCIR Registry if we have this image present there.

Above you can see we have a new image in our container registry now, to see more details about the image, Click on Repository and Images and click on V1

3. Now how to pull the image from the container registry
Before pulling the image, let me delete all my local images

Now let’s pull the same image from the container registry to my local machine
To pull the image copy the pull command from the container registry console

Then use that pull command to pull the image to a local repository.
