Reputation: 3356
I have a template that defines a object "ImageStream":
{
"apiVersion":"v1",
"kind": "ImageStream",
"metadata": {
"name": "${APPLICATION_NAME}-img",
"labels": {
"app": "${APPLICATION_NAME}"
}
},
"spec": {
"tags": [
{
"name": "latest",
"from": {
"kind": "DockerImage",
"name": "rlanhellas/${APPLICATION_NAME}"
}
}
]
}
}
So, after created I got the image inside openshift registry, the oc get is
command return this:
$ oc get is
NAME IMAGE REPOSITORY TAGS UPDATED
safepark-netcore-img default-route-openshift-image-registry.apps.us-east-2.starter.openshift-online.com/safepark/safepark-netcore-img latest About an hour ago
My original image within dockerhub and my pipeline tool always update the latest
tag in dockerhub. But the ImageStream in openshift is not updated, so I got always a old version of my image in openshift and a new build is never triggered because the openshift image is not updated.
How can I "link" the ImageStream in OpenShift to my Dockerhub image and ensure that updated image in dockerhub will update the image in openshift ?
Important: I'm using Openshift Online with Free Plan.
Upvotes: 0
Views: 1467
Reputation: 2314
If you want an image to automatically sync from one registry to your openshift registry, you can use importPolicy
to achieve this.
The OpenShift 3.11 documentation explains the importPolicy
functionality.
Set importPolicy
to true
to automatically sync the image.
apiVersion: v1
kind: ImageStream
metadata:
name: ruby
spec:
tags:
- from:
kind: DockerImage
name: openshift/ruby-20-centos7
name: latest
importPolicy:
scheduled: true
apiVersion: v1
kind: ImageStream
metadata:
name: ruby
spec:
tags:
- from:
kind: DockerImage
name: openshift/ruby-20-centos7
name: latest
importPolicy:
scheduled: true
Upvotes: 2