Saturday, October 13, 2018

How To Push/Pull Docker Images Into Oracle OKE Registry


   We have built some customized docker images for our apps. We need to upload it to OKE registry and being used by  OKE engineer later. Please refer official oracle doc


  • Make sure you have correct privileges to push images to OCI registry. You need your tenancy admin to update the policies to allow you to do that
  • Generate Auth Token from OCI  user settings. see details in official oracle doc
  • On the host where your docker images are, use docker to login
docker login   (we use phoenix region)
If users are federated with another directory services
Username:  <tenancy-namespace>/<federation name>/
i.e.   mytenancy-namespace/corp_login_federate/
If no federation, remove <federation name>
Password:  <The Auth token you generated before>
Login succeed.
  • Tag the images you would like to upload
docker tag hello-world:latest
docker tag hello-world:latest
  • Remember to add "repo-name"
  • Push the image to registry
docker push
  • Pull the image
 docker pull
  • To use it in K8S yaml file, we need to add secret for docker login. Refer k8s doc and oci doc for details
kubectl create secret docker-registry iad-ocir-secret --docker-username='<tenancy-namespace>/<federation name>/' --docker-password='******' --docker-email=''

 part of sample yaml is like

      - name: helloworld
    # enter the path to your image, be sure to include the correct region prefix 
        image: <region-code><tenancy-namespace>/<repo-name>/<image-name>:<tag>
        - containerPort: 80
    # enter the name of the secret you created
      - name: <secret-name>

No comments: