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.
- 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
- Where, 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. /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.
- We now have a new image in our container registry. 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.
Want to find out more about how you can get the best out of OCI?
Get in touch with DSP-Eclipsys today to explore better solutions for your business.