Skip to content

oc import-image creates a invalid images #8457

Closed

Description

@legionus
Version

openshift v1.1.6-3-g9cc9434-dirty
kubernetes v1.2.0-36-g4a3f9c5
etcd 2.2.5

$ oc get svc docker-registry -o yaml |grep clusterIP
  clusterIP: 172.30.167.183

$ docker tag docker.io/busybox 172.30.167.183:5000/tmp/hello-world:latest

$ oc import-image --from=172.30.167.183:5000/tmp/hello-world:latest tmp/foo:v1 --confirm --insecure
The import completed successfully.

Name:           foo
Created:        Less than a second ago
Labels:         <none>
Annotations:        openshift.io/image.dockerRepositoryCheck=2016-04-11T12:49:56Z
Docker Pull Spec:   172.30.167.183:5000/tmp/foo

Tag Spec                        Created         PullSpec    Image
v1  172.30.167.183:5000/tmp/hello-world:latest  Less than a second ago          import failed: dockerimage "172.30.167.183:5000/tmp/hello-world:lat...

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

In docker-registry log you can see:

time="2016-04-11T12:49:56.619139746Z" level=debug msg=GetImageManifest go.version=go1.5.3 http.request.host="172.30.167.183:5000" http.request.id=e165235e-a9e9-466b-a30d-b65adc8b215a http.request.method=GET http.request.remoteaddr="10.34.129.157:41794" http.request.uri="/v2/tmp/hello-world/manifests/latest" http.request.useragent="Go-http-client/1.1" instance.id=9e296c46-bc6b-4a56-8cd5-0c18ddf4e0b1 vars.name="tmp/hello-world" vars.reference=latest 
time="2016-04-11T12:49:56.620518905Z" level=error msg="Error getting ImageStreamTag \"latest\": imagestreams \"hello-world\" not found" go.version=go1.5.3 http.request.host="172.30.167.183:5000" http.request.id=e165235e-a9e9-466b-a30d-b65adc8b215a http.request.method=GET http.request.remoteaddr="10.34.129.157:41794" http.request.uri="/v2/tmp/hello-world/manifests/latest" http.request.useragent="Go-http-client/1.1" instance.id=9e296c46-bc6b-4a56-8cd5-0c18ddf4e0b1 vars.name="tmp/hello-world" vars.reference=latest 
time="2016-04-11T12:49:56.620607189Z" level=error msg="response completed with error" err.code="MANIFEST_UNKNOWN" err.detail="imagestreams \"hello-world\" not found" err.message="manifest unknown" go.version=go1.5.3 http.request.host="172.30.167.183:5000" http.request.id=e165235e-a9e9-466b-a30d-b65adc8b215a http.request.method=GET http.request.remoteaddr="10.34.129.157:41794" http.request.uri="/v2/tmp/hello-world/manifests/latest" http.request.useragent="Go-http-client/1.1" http.response.contenttype="application/json; charset=utf-8" http.response.duration=6.840234ms http.response.status=404 http.response.written=299 instance.id=9e296c46-bc6b-4a56-8cd5-0c18ddf4e0b1 vars.name="tmp/hello-world" vars.reference=latest 

but imagestream will be created:

$ oc get -n tmp is
NAME      DOCKER REPO                      TAGS      UPDATED
foo       172.30.167.183:5000/tmp/foo      v1

$ oc get -n tmp is/foo -o yaml
apiVersion: v1
kind: ImageStream
metadata:
  annotations:
    openshift.io/image.dockerRepositoryCheck: 2016-04-11T12:49:56Z
  creationTimestamp: 2016-04-11T12:49:56Z
  generation: 1
  name: foo
  namespace: tmp
  resourceVersion: "1345"
  selfLink: /oapi/v1/namespaces/tmp/imagestreams/foo
  uid: e4d0bcf5-ffe3-11e5-87ce-507b9d472d2b
spec:
  tags:
  - annotations: null
    from:
      kind: DockerImage
      name: 172.30.167.183:5000/tmp/hello-world:latest
    generation: 1
    importPolicy:
      insecure: true
    name: v1
status:
  dockerImageRepository: 172.30.167.183:5000/tmp/foo
  tags:
  - conditions:
    - generation: 1
      lastTransitionTime: 2016-04-11T12:49:56Z
      message: dockerimage "172.30.167.183:5000/tmp/hello-world:latest" not found
      reason: NotFound
      status: "False"
      type: ImportSuccess
    items: null
    tag: v1

Activity

  1. added
    kind/bug
    and removed on Apr 11, 2016
  2. legionus commented on Apr 12, 2016

    @legionus
    ContributorAuthor

    New output:

    $ $ oc import-image --from=172.30.167.183:5000/tmp/hello-world:latest tmp/bar:v2 --confirm 
    Error from server: Internal error occurred: Failed to import a single tag and digest
    
  3. soltysh commented on Apr 12, 2016

    @soltysh
    Contributor

    @legionus in which way the newly created IS is invalid? It's pointing to exactly that tag you've specified in the import-image command. If you're talking about the error - that's working as expected.

  4. legionus commented on Apr 12, 2016

    @legionus
    ContributorAuthor

    But the resulting imagestream is not suitable for anything. What's the point to create an image if all of tags and digests failed to import ?

    @miminar

  5. soltysh commented on Apr 12, 2016

    @soltysh
    Contributor

    If there will be temporary error in the import (network down, temporary remote registry misbehavior) re-importing the image will fix the problem. You can't assume the spec is wrong. Only user upon verification will know that. @smarterclayton intentionally pushed this solution to do as much as we can during import and let the user identify those single errors.

  6. miminar commented on Apr 12, 2016

    @miminar

    What I consider wrong is the message The import completed successfully. showing up regardless of the number of tags imported successfully.

  7. legionus commented on Apr 12, 2016

    @legionus
    ContributorAuthor

    If there will be temporary error in the import (network down, temporary remote registry misbehavior) re-importing the image will fix the problem. You can't assume the spec is wrong.

    You right I can't. But result of oc import-image ... shouldn't be successful because we failed when importing. At the time of the command execution is the actual execution result.
    I'm wrong that don't show detailed information about the imagestream.

  8. smarterclayton commented on Apr 12, 2016

    @smarterclayton
    Contributor

    The message is wrong, but even more than that, I don't think the output of import-image is even really well suited to the use case anymore. There's three cases:

    1. Creating a new image stream by importing a docker hub image
    2. Updating an existing image stream with changes
    3. Updating an existing image stream with no changes

    All of those could be either successful or failed. For the latter two, we should be showing a more succinct output - what the newest tag is, the id, and when. The other data is useless. For creation, we should show a bit more info (help orient the user that we created an image stream).

  9. soltysh commented on Apr 12, 2016

    @soltysh
    Contributor

    Agree with @smarterclayton. Created #8485 to track it. This issue and accompanying PR can be safely closed.

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

Metadata

Metadata

Assignees

Labels

component/imageregistrykind/bugpriority/P2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions