Welcome to OCI.
Today we are going through the steps to push a docker image to Oracle Cloud Infrastructure
Registry (also known as Container Registry) using an Identity Cloud Service user.
Before you begin, ensure that: Your IDCS user has been assigned to an IDCS
group.
Create an OCI IAM group and map it with the IDCS group.
Create a policy with permissions to manage the “repos” to the IAM group.
Please check the video description for the documentation.
For this demo, I have used a Linux Compute instance.
The first step is to create an Auth Token to your user.
Login to OCI account Go to Identity & Security > Identity > Federation.
Click your Oracle IDCS federation name.
For most tenancies, the federation is named as OracleIdentityCloudService.
Search your IDCS user in the list of existing users and ensure that it has Provisioned aka
Synchronized user against to it.
Click your Synchronized user.
It will open a new window.
You can also come to this page directly by clicking profile Menu > your IDCS username.
It does the same.
Then go to Resources > Auth Tokens.
Click Generate Token > provide a relevant token name > click Generate Token > copy the
Token and save it for docker login.
The second step is to create a Repository if you are working in a non-root compartment.
Go to Developer Services > Containers & Artifacts > Container Registry.
Choose the Region in which you will be working.
Choose a Compartment you have permission to work in.
Click Create repository.
Choose your Compartment, provide Repository name, select registry access based on your
project requirement.
And then click Create repository.
From this page, you need to remember the Repository name, Namespace, Region key.
In this example, the region key is NRT.
You can find regions key in the documentation provided in description.
Please note, if you want to push your docker images in root compartment level, you do not
have to create a repository in advance.
Docker push command does that for you if the repository does not exist already, provided
you have enough policy permissions.
The third step is to build and push docker images to OCI container registry.
Login to your compute server.
Verify if the docker already installed and running?
If not, please see the description for the documentation links.
Go to your application folder.
In this example, I have Hello world Spring boot Java application, and Dockerfile to build
its images.
To build docker image, write a command docker build -t .ocir.io/Namespace/Repo
name:tag press Enter and wait until the image is successfully
built.
You can verify this image using “docker images” command.
Now, authenticate yourself to push docker images to your container registry.
To do that docker login .ocir.io
Enter your username as namespace/Identity provider name/username
Now, provide your Auth Token which was created a while ago.
And press Enter.
Verify the docker login is successful.
To push your docker image, write a command docker push .ocir.io/Namespace/Repo
name:Tag and press Enter.
Finally, lets verify: Go to Developer Services > Containers & Artifacts
> Container Registry Select the Region and Compartment
Expand Repository details.
you will see the list of tags that you’ve pushed.
Click the Tag for more information such as image OCID, size, date and pushed by etc.
Thanks for watching.
Please contact OCI Support if you still need assistance.