从Artifactory拉取docker导致"net/http: request canceled"不一致



我们在 docker 容器中运行 Artifactory 5.11.0(今天刚刚更新到 6.0.2,还没有看到这个(,当我们的自动化从 Artifactory 执行docker pull时,9/10 次成功。 有时,即使从托管 Artifactory 的计算机运行docker pulldocker pull也会失败,并显示:

拉取"码头工人"。artifactory url}/stageaging:latest'... 来自守护程序的错误响应:获取 http://docker。{artifactory url}/v2/staging/manifests/latest: Get http://docker.{artifactory url}:80/artifactory/api/docker/docker/v2/token?account=admin&scope=repository%3Astaging%3Apull&service=docker.{artifactory url}%3A80: net/http:请求已取消(等待时超出客户端超时 标题(

就像我说的,大多数时候这是完美的,但是在自动化构建期间,我们会遇到上述错误,这 1/10(可能更少(。 我尝试在一夜之间运行docker pull循环,直到它遇到故障并且没有失败。 运行了一夜,没有数据包丢失。

操作系统:Debian 9 x64
Docker 版本 17.09.0-ce,构建 afdb6d4,似乎在 Docker 版本 18.03.1~ce-0~debian 中更频繁地发生,但我没有直接证据表明客户端有错。

这是 JFrog 为我提供的尝试解决此问题的内容。(注意:我们当时使用的是旧版本的Artifactory,他们确实建议我们将其更新到最新版本,因为有几个更新可以提供帮助(。

The RAM value -Xmx 2g was the default value provided by Artifactory. We can increase that value by going into the Docker container "docker exec -it artifactory bash"
and then $Artifactory_Home/bin/artifactory.default ( Mostly: - /opt/jfrog/artifactory/bin/artifactory.default) and we can change the RAM value accordingly. Please follow this link for more information.
We should also change the access max threads count and we can do that by going to $Artifactory_Home/tomcat/config/server.xml and change it to:
<Connector port="8040" sendReasonPhrase="true" maxThreads="<200>"/>
Also add below line in /var/opt/jfrog/artifactory/etc/artifactory.system.properties
artifactory.access.client.max.connections=200
To deal with heavy loads we need to append the below line  in /var/opt/jfrog/artifactory/etc/db.properties.Please follow this link for more information.
pool.max.active=200

此外,他们告诉我,在使用Artifactory而不是user/pass登录对docker客户端进行身份验证时,请确保我们使用API密钥,因为后者将通过我们的ldap身份验证,而前者不会:

要尝试的一件事是使用 API 密钥而不是纯文本密码,因为使用 API 密钥不会到达 LDAP 服务器。

我们已经这样做了,所以这对这个问题没有影响。

还张贴在这里: https://www.jfrog.com/jira/browse/RTFACT-17919?focusedCommentId=66063&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-66063

我希望这对我们有帮助,因为它对我们有帮助。

最新更新