Bug 1375323

Summary: [RFE] improve error message when supplying invalid sha256 ID during 'docker pull'
Product: Red Hat Enterprise Linux 7 Reporter: Micah Abbott <miabbott>
Component: podmanAssignee: Brent Baude <bbaude>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Jenner <mjenner>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.6CC: dwalsh, jligon, jnovy, lsm5, mheon, miabbott, umohnani, vrothber
Target Milestone: rcKeywords: Extras, FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: podman-1.4.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-19 11:25:24 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:

Description Micah Abbott 2016-09-12 17:35:05 UTC
When trying to pull an image by sha256 ID and an invalid ID is used, the error message is not helpful:

# docker pull rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924
Trying to pull repository registry.access.redhat.com/rhel7 ... 
Error parsing HTTP response: invalid character 'F' looking for beginning of value: "File not found.\""
Trying to pull repository docker.io/library/rhel7 ... 
unauthorized: authentication required
unauthorized: authentication required


-bash-4.2# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.14.x86_64
 Go version:      go1.6.2
 Git commit:      5206701-unsupported
 Built:           Mon Aug 29 14:00:01 2016
 OS/Arch:         linux/amd64

Server:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.14.x86_64
 Go version:      go1.6.2
 Git commit:      5206701-unsupported
 Built:           Mon Aug 29 14:00:01 2016
 OS/Arch:         linux/amd64

-bash-4.2# rpm -q docker
docker-1.10.3-46.el7.14.x86_64

Comment 1 Micah Abbott 2016-09-12 18:35:31 UTC
I've found three different error messages that can get returned when using invalid sha256 IDs:


The rogue 'rhel7' on docker.io looks like it is a v1 image (when pulling it by name), so we get this error when using an invalid sha256 ID

-bash-4.2# docker pull docker.io/rhel7@sha256:64a02df6aac27d1200c2572fe4b9949f1970d05f74d367ce4af994ba5dc3669e
Trying to pull repository docker.io/library/rhel7 ... 
unauthorized: authentication required


The 'fedora' image on docker.io appears to be in v2 format, so this error message is a little better.  Although, I think there is room for improvement.

-bash-4.2# docker pull docker.io/fedora@sha256:64a02df6aac27d1200c2572fe4b9949f1970d05f74d367ce4af994ba5dc36695
Trying to pull repository docker.io/library/fedora ... 
manifest unknown: manifest unknown


And the 'rhel7' image on registry.access.redhat.com is in v2 format, but it appears our registry is returning some bad data.

-bash-4.2# docker pull registry.access.redhat.com/rhel7@sha256:64a02df6aac27d1200c2572fe4b9949f1970d05f74d367ce4af994ba5dc36695
Trying to pull repository registry.access.redhat.com/rhel7 ... 
Error parsing HTTP response: invalid character 'F' looking for beginning of value: "File not found.\""

Comment 3 Daniel Walsh 2017-06-30 14:54:22 UTC
Micah is this fixed in the latest versions?

Comment 4 Micah Abbott 2017-06-30 15:09:11 UTC
Nope, the exact behavior described in comment #1 still exists in the latest version.


# atomic host status
State: idle
Deployments:
● rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard
             Version: 7.3.6 (2017-06-23 16:20:45)
              Commit: e073a47baa605a99632904e4e05692064302afd8769a15290d8ebe8dbfd3c81b

# rpm -q docker
docker-1.12.6-32.git88a4867.el7.x86_64

# docker pull docker.io/rhel7@sha256:64a02df6aac27d1200c2572fe4b9949f1970d05f74d367ce4af994ba5dc3669e
Trying to pull repository docker.io/library/rhel7 ... 
unauthorized: authentication required

# docker pull docker.io/fedora@sha256:64a02df6aac27d1200c2572fe4b9949f1970d05f74d367ce4af994ba5dc36695
Trying to pull repository docker.io/library/fedora ... 
manifest unknown: manifest unknown

# docker pull registry.access.redhat.com/rhel7@sha256:64a02df6aac27d1200c2572fe4b9949f1970d05f74d367ce4af994ba5dc36695
Trying to pull repository registry.access.redhat.com/rhel7 ... 
error parsing HTTP 404 response body: invalid character 'F' looking for beginning of value: "File not found.\""

Comment 5 Daniel Walsh 2017-07-02 10:06:23 UTC
Antonio, how does skopeo/kpod pull do on this?

Comment 6 Daniel Walsh 2019-01-02 21:27:49 UTC
Here is what Podman does

podman pull rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924
Trying to pull docker.io/rhel7:none...Failed
Trying to pull registry.fedoraproject.org/rhel7:none...Failed
Trying to pull quay.io/rhel7:none...Failed
Trying to pull registry.access.redhat.com/rhel7:none...Failed
Trying to pull registry.centos.org/rhel7:none...Failed
error pulling image "rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924": unable to pull rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924: 5 errors occurred:

* Error determining manifest MIME type for docker://rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924: Error reading manifest sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924 in docker.io/library/rhel7: errors:
denied: requested access to the resource is denied
unauthorized: authentication required

* Error determining manifest MIME type for docker://registry.fedoraproject.org/rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924: Error reading manifest sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924 in registry.fedoraproject.org/rhel7: manifest unknown: manifest unknown
* Error determining manifest MIME type for docker://quay.io/rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924: Error reading manifest sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924 in quay.io/rhel7: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\n<title>404 Not Found</title>\n<h1>Not Found</h1>\n<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>\n"
* Error determining manifest MIME type for docker://registry.access.redhat.com/rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924: Error reading manifest sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924 in registry.access.redhat.com/rhel7: error parsing HTTP 404 response body: invalid character 'F' looking for beginning of value: "File not found.\""
* Error determining manifest MIME type for docker://registry.centos.org/rhel7@sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924: Error reading manifest sha256:deadbeef91d26337900510275d268f7aa817026f3327c91620ca266c2cc26924 in registry.centos.org/rhel7: manifest unknown: manifest unknown

Not much better.

Comment 7 Daniel Walsh 2019-01-02 21:29:31 UTC
Micah, Do you like Podmans output any better?

Comment 8 Micah Abbott 2019-01-03 14:33:45 UTC
(In reply to Daniel Walsh from comment #7)
> Micah, Do you like Podmans output any better?

It looks like the error messages from `podman` are about the same when compared to the messages from `docker`.  So
not really much better.

I'll hazard a guess that they are coming from the registry and/or are part of the protocol itself.  If this is
the case, then it is probably unreasonable to get the error messages improved.

One improvement that might be made is to print additional help messages in the case of "manifest unknown".  Something
like, "The provided sha256sum was not able to be retrieved from the registry.  Check that the name of the image and
sha256sum is correct".

Comment 9 Brent Baude 2019-01-03 14:59:40 UTC
Want me to take a look at this?

Comment 10 Daniel Walsh 2019-01-03 15:23:07 UTC
Sure.

Comment 11 Valentin Rothberg 2019-07-25 14:56:09 UTC
The error messages will be much better with the next update to Podman v1.4.x.