All about OCIR (Oracle Cloud Infrastructure Registry) in OCI

 What is OCIR:

Oracle Cloud Infrastructure Registry, also known as 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 OCIR repository
2. How to push docker Image to OCIR Repository
3. How to pull Image from OCIR Repository



1. How to create 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 public)


2. How to Push Docker Image to OCIR repository:

To push an image first we have to generate an Auth token, to 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 below screen


Copy and save this token somewhere.

Now to push the docker image to 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 have docker installed.

Click on developer tool --> Cloud shell 


and I will login into container registry using docker login command

docker login <region_key>.ocir.io

Where,

<region-key> is the key for the Oracle Cloud Infrastructure Registry region you're
using. 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 container registry, first check what local images present into this machine. To push local image to container registry I need to Tag the source image first


here is the above tag command we have to give the full path of container target repository where we want to push the image

i.e. <region-key>/tenancy namespace>/ocir repository name

Now check if new image created with new tag and then push the image into container registry


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


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


3. Now how to pull the image from container registry

Before pull the image, let me delete all my local images



Now let's pull the same image from container registry to my local machine

To pull the image copy the pull command from container registry console


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





No comments:

Post a Comment

Analyze Invoices with Oracle Analytics and AI Document Understanding

OCI Document Understanding is an AI service that enables developers to extract text, tables, and other key data from document files through...