Bug 1119579

Summary: customize docker pull 404 error
Product: Red Hat Enterprise Linux 7 Reporter: Guohua Ouyang <gouyang>
Component: dockerAssignee: William Henry <whenry>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: bsarathy, dwalsh, leiwang, lsu, mjenner
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-18 20:46:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1109938    

Description Guohua Ouyang 2014-07-15 06:07:18 UTC
Description of problem:
If the image does not exist, docker pull throws error "HTTP code: 404".
The 404 status code means the request page or resource does not exist, it's not so obviously that docker pull is requesting a web page although it does.  Make it more readable to all users would be better.

Suggest change the error message like git does:
$ git clone non-exist-repo
fatal: repository 'non-exist-repo' does not exist

docker pull current gives error:
# docker pull non-exist-image
2014/07/15 13:33:52 Error: HTTP code: 404

suggest change to:
# docker pull non-exist-image
2014/07/15 13:33:52 Error: image "non-exist-image" does not exist
or
2014/07/15 13:33:52 Error: image "non-exist-image" not found

Version-Release number of selected component (if applicable):
docker-1.0.0-10.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 William Henry 2014-07-15 19:11:31 UTC
So I would assume that it could be some other error besides 404. Should I be checking for other errors?

Right now I have it such that when I catch the error I check to see if it's actually a 404 and if it is I create a image not found message (as described above). And if it's not I just return what came back - presumably some other HTTP error.

Could there be other 40x or 50x errors? Should I have (pseudo):

if err
   if 404
      return "image not found"
   else
      return "unknown error"  // rather than return err

Comment 4 Daniel Walsh 2014-07-15 19:49:18 UTC
If we know of other return codes that are likely and could translate them, I would otherwise I would say.

if err
   if 404
      return "image not found"
   else
      return err

Comment 5 William Henry 2014-07-16 00:53:00 UTC
I have committed and pushed a PR upstream:

https://github.com/dotcloud/docker/pull/7043

Comment 7 Daniel Walsh 2014-07-22 16:22:31 UTC
Ok we will pull this into the next docker package after docker-1.1.1-2

Comment 8 Luwen Su 2014-08-05 09:14:46 UTC
Via docker-1.1.2-6.el7.x86_64

#docker pull not_exist
Pulling repository not_exist
2014/08/05 17:13:51 Error: image not_exist not found

Set Verified

Comment 9 errata-xmlrpc 2014-09-18 20:46:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1266.html