My scrapbook about anything which I learned or want to remember, Sometime about tech tips, thoughts and rambling. If you find anything useful don't forget to give thumbs-up :)

Breaking

Monday, February 15, 2021

Deploy Openshift App from a Private Image Repository

In Post "Building Openshift App from a Private Git Repository" we have seen how to exploit enterprise or private git to deploy an application in Openshift, Today, we are going to explore the same but from a private or enterprise image registry also known as Image Artifactory.   


Let's assume we need to deploy quay.io/atulsingh0/php-hello-dockerfile:latest in Openshift where quay.io/atulsingh0 is a private image repository and php-hello-dockerfile:latest is the image.

Setup Private image repository access:

 $ oc create secret docker-registry image-registry-cred \  
     --docker-server=quay.io \  
     --docker-username=atulsingh0 \  
     --docker-password=YourPasswordForRepo  

 $ oc secrets link builder image-registry-cred --for=pull  
 $ oc secrets link default image-registry-cred --for=pull  

In above command, we have created a secret to access private image repo and then link the secrets to default & builder service account on Openshift for pull. 

Now, you can deploy the image by below command - 

$ oc import-image php-hello-dockerfile:latest \
        --from=http://quay.io/atulsingh0/php-hello-dockerfile:latest \
        --confirm

$ oc new-app --name hello-pho \
    -i php-hello-dockerfile:latest

As we already enabled the image-registry secret with builder & default service account, we can easily pull the image as image stream in Openshift and then run the deployment command. 
This is it for this post, let me know what else you want to know about Openshift in comment section, till then.. Happy Learning !!!



Like the below page to get the update  
Facebook Page      Facebook Group     Twitter Feed      Telegram Group



No comments:

Post a Comment

Disclaimer

The postings on this site are my own and don't necessarily represent IBM's or other companies positions, strategies or opinions. All content provided on this blog is for informational purposes and knowledge sharing only.
The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of his information.