5

I have created one project testing1 in which i published docker images.

Now, i want to created similar another project testing2 with same images that i pushed in testing1. I don’t want to publish it again.

pl_rock
  • 14,054
  • 3
  • 30
  • 33
purna ram
  • 402
  • 1
  • 4
  • 14

1 Answers1

16

Login to your openshift command line and run command:

oc policy add-role-to-user \
    system:image-puller system:serviceaccount:testing2:default \
    --namespace=testing1

OR

oc policy add-role-to-user \
    system:image-puller system:serviceaccount:testing2:default \
    -n testing1

Your project testing2 will be able to access images from project testing1 in your openshift.

For more information refer openshift Documentation

pmckeown
  • 3,419
  • 3
  • 31
  • 35
pl_rock
  • 14,054
  • 3
  • 30
  • 33
  • I *think*, though I'm not 100% sure, that you've got it exactly backwards: `testing1` will be allowed to pull images from `testing2`. After all, you are creating a permission for `testing1` in `testing2`, not vice versa. – Nikolai Prokoschenko Jul 09 '18 at 07:19
  • 1
    From the docs: `When using the internal registry, to allow pods in project-a (testing1) to reference images in project-b (testing2), a service account in project-a must be bound to the system:image-puller role in project-b` So you are correct Nikolai, the answer is backwards. The service account in testing2 needs to be given access to pull from testing1. – pmckeown Sep 12 '18 at 05:24
  • is it possible to allow all projects to pull images from the project testing1 ? – alixander Aug 05 '19 at 15:41