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
Facebook Page Facebook Group Twitter Feed Telegram Group
No comments:
Post a Comment