From 12ec4084019a661fe251b7f3141e4b59ef3ab2de Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Tue, 24 Sep 2019 15:26:23 -0400 Subject: [PATCH] add http response to log fix https://github.com/containers/libpod/issues/3884 Add http response message log to show server-side error message. Signed-off-by: Qi Wang --- docker/docker_client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker/docker_client.go b/docker/docker_client.go index 48427f3d37..3543b49b61 100644 --- a/docker/docker_client.go +++ b/docker/docker_client.go @@ -533,6 +533,11 @@ func (c *dockerClient) getBearerToken(ctx context.Context, challenge challenge, defer res.Body.Close() switch res.StatusCode { case http.StatusUnauthorized: + resBody, err := ioutil.ReadAll(res.Body) + if err != nil { + return nil, err + } + logrus.Debugf("%s", string(resBody)) return nil, ErrUnauthorizedForCredentials case http.StatusOK: break