DEV Community

Faris Durrani
Faris Durrani

Posted on • Updated on

Pushing Docker image to Oracle Container Registry

Oftencase the Docker hub is where general open-source developers store their Docker images. But occasionally when you want to use the Oracle Cloud Infrastructure, you'd want to upload those images to your cloud tenancy's private Container Registry to simplify your development to production workflow. Here's how you do it.

Note: To use this service, you must upgrade to a paid account.

How to connect to the Container Registry

1. Find your tenancy namespace in Oracle Cloud > Profile Picture > Tenancy, e.g. iddriaq7lag549

OCI console screenshot of Tenancy details page showing namepspace

2. Create an Auth Token in your Oracle Cloud > Profile > My Profile > User Settings > Auth Tokens. This will be your Docker login password.

Auth Token creation page

3. Login to the Container Registry on Docker using:

docker login ocir.us-ashburn-1.oci.oraclecloud.com
Enter fullscreen mode Exit fullscreen mode

If you are not using the Ashburn (IAD) region, please refer to this list for your docker login URL.

4. The Terminal will prompt you for your username and password. Your username and password will look like this:

Username: idrriaq7lag5/fdurrani@mythics.com
Password: DBY75ZmVsc_v3!Qg6duC

where:

  • idrriaq7lag5 is the tenancy namespace you found in Step 1
  • fdurrani@mythics.com is your Oracle Cloud login email
  • the password is the Auth Token retrieved in Step 2

Important: include your Domain if it is not the default domain. If your domain is Federated, your username will be idrriaq7lag5/federated/fdurrani@mythics.com

Of course, you can also do a one-liner:

docker login -u 'idrriaq7lag5/fdurrani@mythics.com' -p 'DBY75ZmVsc_v3!Qg6duC' ocir.us-ashburn-1.oci.oraclecloud.com
Enter fullscreen mode Exit fullscreen mode

5. Now you can build, push, and pull your Docker images as usual using:

docker build -t ocir.us-ashburn-1.oci.oraclecloud.com/idrriaq7lag5/myImage:latest .
docker push ocir.us-ashburn-1.oci.oraclecloud.com/idrriaq7lag5/myImage:latest
docker pull ocir.us-ashburn-1.oci.oraclecloud.com/idrriaq7lag5/myImage:latest
Enter fullscreen mode Exit fullscreen mode

You will find the pushed image in the Container Registry (root compartment). You can move the image to any other compartment afterwards.

6. If you want to logout, simply:

docker logout ocir.us-ashburn-1.oci.oraclecloud.com
Enter fullscreen mode Exit fullscreen mode

And that's a short guide to using Docker for Oracle Cloud's Container Registry.

References:

  1. Overview of Container Registry
  2. Logging in to Oracle Cloud Infrastructure Registry
  3. Pushing Images Using the Docker CLI

Safe harbor statement
The information provided on this channel/article/story is solely intended for informational purposes and cannot be used as a part of any contractual agreement. The content does not guarantee the delivery of any material, code, or functionality, and should not be the sole basis for making purchasing decisions. The postings on this site are my own and do not necessarily reflect the views or work of Oracle or Mythics, LLC.

This work is licensed under a Creative Commons Attribution 4.0 International License.

Top comments (0)