nydus icon indicating copy to clipboard operation
nydus copied to clipboard

Nydusify should use http client with retry for pull&push image

Open zyfjeff opened this issue 3 years ago • 0 comments

time="2022-08-02T00:41:54Z" level=info msg="Version: 10859e84d99d14bdbc9c53c82ca5963190c3f15b.20220708.0625\n"
time="2022-08-02T00:41:54Z" level=info msg="Parsing image localhost:5000/centos:nydus-nightly-v5"
time="2022-08-02T00:41:54Z" level=info msg="Parsing image centos:latest"
time="2022-08-02T00:42:52Z" level=fatal msg="parse source image: pull image index: read image resource: httpReadSeeker: failed open: failed to do request: Get \"[https://registry-1.docker.io/v2/library/centos/manifests/sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177\](https://registry-1.docker.io/v2/library/centos/manifests/sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177/)": EOF"

Our Convert Top Docker Hub Images test occasionally fails due to network issues.

func newDefaultClient() *http.Client {
	return &http.Client{
		Transport: &http.Transport{
			Proxy: http.ProxyFromEnvironment,
			DialContext: (&net.Dialer{
				Timeout:   30 * time.Second,
				KeepAlive: 30 * time.Second,
				DualStack: true,
			}).DialContext,
			MaxIdleConns:          10,
			IdleConnTimeout:       30 * time.Second,
			TLSHandshakeTimeout:   10 * time.Second,
			ExpectContinueTimeout: 5 * time.Second,
			DisableKeepAlives:     true,
			TLSNextProto:          make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
		},
	}
}

replace it to retryhttpclient

zyfjeff avatar Aug 02 '22 09:08 zyfjeff