Add the mediaType to the error #30047

Open
wants to merge 1 commit into
from

Projects

None yet

4 participants

@duglin
Contributor
duglin commented Jan 11, 2017

Without this fix the error the client might see is:
target is unknown
which wasn't helpful to me when I saw this today. With this fix I
now see:
MediaType is unknown: 'text/html'
which helped me track down the issue to the registry I was talking to.

Signed-off-by: Doug Davis dug@us.ibm.com

@AkihiroSuda
Contributor

This test needs to be updated

00:42:29.420 ----------------------------------------------------------------------
00:42:29.421 FAIL: docker_cli_plugins_test.go:173: DockerRegistrySuite.TestPluginInstallImage
00:42:29.421 
00:42:29.421 docker_cli_plugins_test.go:184:
00:42:29.421     c.Assert(out, checker.Contains, "target is image")
00:42:29.421 ... obtained string = "Error response from daemon: MediaType is image: \"application/vnd.docker.container.image.v1+json\"\n"
00:42:29.422 ... substring string = "target is image"
00:42:29.422 
00:42:32.844 
00:42:32.844 ----------------------------------------------------------------------
@duglin duglin Add the mediaType to the error
Without this fix the error the client might see is:
	target is unknown
which wasn't helpful to me when I saw this today. With this fix I
now see:
	MediaType is unknown: 'text/html'
which helped me track down the issue to the registry I was talking to.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2d3b45a
@duglin
Contributor
duglin commented Jan 12, 2017
@@ -74,7 +74,7 @@ func runPull(dockerCli *command.DockerCli, opts pullOptions) error {
err = imagePullPrivileged(ctx, dockerCli, authConfig, distributionRef.String(), requestPrivilege, opts.all)
}
if err != nil {
- if strings.Contains(err.Error(), "target is plugin") {
+ if strings.Contains(err.Error(), "MediaType is plugin") {
return errors.New(err.Error() + " - Use `docker plugin install`")
@aaronlehmann
aaronlehmann Jan 13, 2017 Contributor

Perhaps the CLI should strip the mediatype here (and in the plugin case) to make the user-visible error less verbose.

I agree that having the mediatype in the general case is useful.

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