From 726f3e07e39561bbe75b0e9696d7130adc17a97b Mon Sep 17 00:00:00 2001 From: Jessica Frazelle Date: Tue, 21 Jul 2015 18:45:17 -0700 Subject: [PATCH] better i/o timeout error on pull Signed-off-by: Jessica Frazelle --- docs/session.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/session.go b/docs/session.go index 75947e70..cb982353 100644 --- a/docs/session.go +++ b/docs/session.go @@ -404,7 +404,14 @@ func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error) { req.Header.Set("X-Docker-Token", "true") res, err := r.client.Do(req) if err != nil { - return nil, err + // check if the error is because of i/o timeout + // and return a non-obtuse error message for users + // "Get https://index.docker.io/v1/repositories/library/busybox/images: i/o timeout" + // was a top search on the docker user forum + if strings.HasSuffix(err.Error(), "i/o timeout") { + return nil, fmt.Errorf("Network timed out while trying to connect to %s. You may want to check your internet connection or if you are behind a proxy.", repositoryTarget) + } + return nil, fmt.Errorf("Error while pulling image: %v", err) } defer res.Body.Close() if res.StatusCode == 401 {