![在 Docker 容器中从 Gitlab 克隆 Git 的速度非常慢](https://linux22.com/image/735660/%E5%9C%A8%20Docker%20%E5%AE%B9%E5%99%A8%E4%B8%AD%E4%BB%8E%20Gitlab%20%E5%85%8B%E9%9A%86%20Git%20%E7%9A%84%E9%80%9F%E5%BA%A6%E9%9D%9E%E5%B8%B8%E6%85%A2.png)
我正在尝试将我们的 Gitlab 存储库克隆到 docker 容器中,并在运行 Ubuntu 18.04.1 的新 VM 上运行。
出于某种原因,当我尝试克隆存储库时,我花了很长时间(几分钟)查看,Cloning into ${REPONAME}
然后才最终开始枚举对象。
time git clone https://gitlab.com/gnutls/gnutls.git
Cloning into 'gnutls'...
remote: Enumerating objects: 178256, done.
remote: Counting objects: 100% (178256/178256), done.
remote: Compressing objects: 100% (50440/50440), done.
remote: Total 178256 (delta 128831), reused 173620 (delta 125853)
Receiving objects: 100% (178256/178256), 66.50 MiB | 10.14 MiB/s, done.
Resolving deltas: 100% (128831/128831), done.
real 5m 2.14s
user 0m 14.42s
sys 0m 4.39s
我决定尝试克隆一个托管google test
在 Github 上的不同 repo,结果发现差异令人震惊。
time git clone https://github.com/google/googletest.git
Cloning into 'googletest'...
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 16478 (delta 8), reused 19 (delta 8), pack-reused 16455
Receiving objects: 100% (16478/16478), 5.74 MiB | 6.53 MiB/s, done.
Resolving deltas: 100% (12141/12141), done.
real 0m 2.58s
user 0m 1.48s
sys 0m 0.39s
Github 克隆比 Gitlab 克隆快得多!
我在虚拟机上测试了同样的事情,而不是在 Docker 容器内,克隆表现完美。我确信这一定是一些 docker 配置问题,但我不知道从哪里开始。