自建了 nexus 3 的 docker 镜像站,尝试推送镜像时报错:

❯ docker push docker.private.zaneliu.me/cyberfarm-frontend:0.0.1                                                                                                                                                                                                                                                                                                   

The push refers to a repository [localhost:5000/ubuntu]
2f1da5476ba7: Pushing [==================================================>] 136.4 MB
could not verify layer data for: sha256:2f1da5476ba736f1c02df28b51515b4a996a55d6d8378a480ef7486a0d568ae2. This may be because internal files in the layer store were modified. Re-pulling or rebuilding this image may resolve the issue

第一次遇到这种问题很奇怪啊,之前推到公司镜像仓、推阿里云等都没有问题,排查了有够半天,从我 VPS 的丢包、tailscale 的打洞、Oracle 服务器的稳定,到网卡、注册表,排查了一整遍,发现竟然是因为 Nginx 的

client_max_body_size

大小默认为 1M 导致的!!!

基于此,将 Nginx 的配置一改:

server
{
    listen 80;
    listen 443 ssl http2 ;
    listen [::]:443 ssl http2 ;
    listen [::]:80;

	# ... 你的其他配置,加入此行 ↓(不一定非要 50000M,随便多大但是一定要大于单个 layer 的大小)
    client_max_body_size 50000M;
}

就行了!