Skip to content

Cannot import an image from internal registry if source and destination projects differ #7985

Closed

Description

@miminar

Version

openshift v1.1.3-600-g8c064d9-dirty
kubernetes v1.2.0-origin-41-g91d3e75
etcd 2.2.5

Description

Cannot import image from internal registry due to:

Reason:"Unauthorized", Message:"you may not have access to the Docker image \"172.30.163.69:5000/extended-test-imagequota-admission-6znr2-shared/src@sha256:bb08da7a0b99af72aebe0ead77009d28771a30dbe4d99f49bf3d29407c72e48f\""

Steps To Reproduce

  1. deploy a registry
  2. create two projects with the same user (e.g. foo and bar)
  3. build an image or manually push it to some image stream in the first project (e.g. foo/randdata@sha256:c8956f7fc18eb5a99a0bbf62c91d90ccd7cf16ec21f15ca901713c04d26)
  4. switch to the other project (oc project bar)
  5. try to import the image to a new image stream

Using a command like:

oc import-image newis --confirm --insecure --loglevel=5 --from=172.30.104.152:5000/foo/randdata@sha256:c8956f7fc18eb5a99a0bbf62c91d90ccd7cf16ec21f15ca901713c04d26f8f9d

Current Result

The import completed successfully.

Name:                   newis
Created:                Less than a second ago
Labels:                 <none>
Annotations:            openshift.io/image.dockerRepositoryCheck=2016-03-14T10:47:27Z
Docker Pull Spec:       172.30.104.152:5000/foo/randdata

Tag     Spec                                                            Created                 PullSpec        Image
latest  172.30.104.152:5000/foo/randdata@sha256:c8956f7fc18eb5...      Less than a second ago                  import failed: you may not have access to the Docker image "172.30....

  ! tag is insecure and can be imported over HTTP or self-signed HTTPS

Expected Result

The import completed successfully.

Name:                   another
Created:                Less than a second ago
Labels:                 <none>
Annotations:            openshift.io/image.dockerRepositoryCheck=2016-03-14T10:57:37Z
Docker Pull Spec:       172.30.104.152:5000/foo/randdata

Tag     Spec                                                            Created                 PullSpec        Image
latest  172.30.104.152:5000/foo/randdata@sha256:c8956f7fc18eb5... !  Less than a second ago  <same>          <same>

  ! tag is insecure and can be imported over HTTP or self-signed HTTPS

Additional Information

It's working if the source and destination namespace are the same.

Activity

  1. miminar commented on Mar 14, 2016

    @miminar
    Author
  2. assigned and unassigned on Mar 14, 2016
  3. liggitt commented on Mar 18, 2016

    @liggitt
    Contributor

    I think you have to grant permissions to the other namespace's service accounts to pull

  4. liggitt commented on Mar 18, 2016

    @liggitt
    Contributor

    oc policy-add-role-to-group system:image-puller system:serviceaccounts:bar -n foo

  5. soltysh commented on Mar 18, 2016

    @soltysh
    Contributor

    Just checked - it works. @miminar mind closing this.

  6. miminar commented on Mar 18, 2016

    @miminar
    Author

    Is this really the way how it's supposed to work? It's super confusing. We should at least document it somewhere.

  7. liggitt commented on Mar 18, 2016

    @liggitt
    Contributor

    if you want project A to be able to pull from project B's image streams? yes... you need to grant it permission

  8. soltysh commented on Mar 18, 2016

    @soltysh
    Contributor

    @miminar your wish is my command openshift/openshift-docs#1765

  9. miminar commented on Mar 18, 2016

    @miminar
    Author

    @soltysh you're my hero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions