Pushing a Container to Oracle Cloud Infrastructure Registry (OCIR) and Pulling it from OKE


OCIR is a Docker v2 compliant private registry provided by Oracle in their OCI (Oracle Cloud Infrastructure) offering.

Let’s have a look at it.

First log in to the repository this way: docker login <region-code>.ocir.io, where <region-code> is documented here.

Then, you’ll need a user/password.

For the user, provide an existing user in the OCI tenancy.  Use the following format: <ocir namespace>/<username>

For the password you must create an OAuth token as follows:

Now you can log in the registry:

docker login fra.ocir.io
Username: fr......ng/tdmin
Password:
Login Succeeded

Now you can push a local image to the registry:

docker images
...
docker tag myweblogic fra.ocir.io/telefonicacloud2/atrepo/weblogic
docker push fra.ocir.io/telefonicacloud2/atrepo/weblogic

Now, for pulling the image from k8s we need a secret, let’s create one:

kubectl create secret docker-registry mycredential --docker-username=tlfnccld2/tdmn --docker-password='-obyChBtururubJ<)O5z_fHcQI' --docker-server=fra.ocir.io

Now we can create a deployment and reference the credential in the yaml as follows:

...
    spec:
      containers:
      - image: fra.ocir.io/tlfnccld2/atrepo/weblogic:latest
        name: orcldb
        ports:
        - containerPort: 1521
          name: orcldb
        volumeMounts:
        - name: data
          mountPath: /ORCL
      imagePullSecrets:
        - name: mycredential
...

You can find a complete example here.

Enjoy 🙂

One Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.