Skip to content
This repository was archived by the owner on Oct 10, 2020. It is now read-only.
This repository was archived by the owner on Oct 10, 2020. It is now read-only.

Need to handle pull 404 image #636

Closed

Description

@aweiteka

Pulling an image that doesn't exist returns...

$ sudo atomic --debug pull docker.io/aweiteka/hello-openshift:latest
Image docker.io/aweiteka/hello-openshift:latest is being pulled to docker ...
ReturnTuple(return_code=1, stdout='', stderr='time="2016-09-20T08:38:22-04:00" level=fatal msg="error fetching manifest: status code: 404, body: {\\"errors\\":[{\\"code\\":\\"MANIFEST_UNKNOWN\\",\\"message\\":\\"manifest unknown\\",\\"detail\\":{\\"Tag\\":\\"latest\\"}}]}\\n" \n')
Traceback (most recent call last):
  File "/bin/atomic", line 186, in <module>
    sys.exit(_func())
  File "/usr/lib/python2.7/site-packages/Atomic/pull.py", line 54, in pull_image
    handler()
  File "/usr/lib/python2.7/site-packages/Atomic/pull.py", line 37, in pull_docker_image
    fq_name = skopeo_inspect("{}{}".format(pull_uri, self.args.image))['Name']
  File "/usr/lib/python2.7/site-packages/Atomic/util.py", line 274, in skopeo_inspect
    raise ValueError(results)
ValueError: ReturnTuple(return_code=1, stdout='', stderr='time="2016-09-20T08:38:22-04:00" level=fatal msg="error fetching manifest: status code: 404, body: {\\"errors\\":[{\\"code\\":\\"MANIFEST_UNKNOWN\\",\\"message\\":\\"manifest unknown\\",\\"detail\\":{\\"Tag\\":\\"latest\\"}}]}\\n" \n')

Version: 1.12.3

Activity

  1. rhatdan commented on Oct 11, 2016

    @rhatdan
    Member

    I began playing with this, but I am failing to get even to the point of this error.

  2. baude commented on Oct 11, 2016

    @baude
    Member

    IMHO, we need to work in return codes to skopeo so we can catch this kind of stuff.

  3. rhatdan commented on Oct 11, 2016

    @rhatdan
    Member

    I think skopeo is returning lots of data in the form of a json data. and we need to parse this to get some kind of better error message for the user.

    @runcom is this the intention?

  4. runcom commented on Oct 11, 2016

    @runcom
    Contributor

    @runcom is this the intention?

    yes, I'm having the same issue when integrating simple signing into projectatomic/docker but I'm definitely just going to parse skopeo's output for now - we could work on error codes though.

    I began playing with this, but I am failing to get even to the point of this error.

    This should trigger that error I guess:

    $ sudo atomic --debug pull docker.io/runcom/doesnotexist:latest
    
  5. baude commented on Oct 11, 2016

    @baude
    Member

    It would seem that a combination of both could be the best option. Suppose the return code was '99' which meant not found, we could then parse out some details from the JSON. If you look at the original error message, it doesn't have real user level informative information. I think the following codes could make sense:

    • not found
    • bad or no auth
    • syntax error

    and probably a couple more.

  6. rhatdan commented on Oct 11, 2016

    @rhatdan
    Member

    Just use ERRNO for those if possible. Or codes defined for http, lets not design our own new codes.

  7. baude commented on Oct 11, 2016

    @baude
    Member

    Looking at the skopeo/containers code, the error messages come largely from docker code and are just sprintf'd as a return.

  8. runcom commented on Oct 11, 2016

    @runcom
    Contributor

    Can't you just map say 404 to not found if it's in the output? it's exactly what I'm doing for now in docker/docker. I agree we need better errors though.

  9. baude commented on Oct 11, 2016

    @baude
    Member

    Sure of course. But frankly I was trying to avoid that and do the work once. In theory, returns shouldn't be a big deal. Parsing is error prone which is why in some ways I was waiting. It is also why I looked at the actual code to see how easy it might be.

  10. added a commit that references this issue on Jan 31, 2017
  11. baude commented on Jan 31, 2017

    @baude
    Member
  12. baude commented on Feb 1, 2017

    @baude
    Member

    @aweiteka I think I have resolved this with the commit 3f1ed62 ... mind closing if you agree or else let me know

  13. baude commented on Feb 13, 2017

    @baude
    Member

    Closing, re-open if not happy.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions