我设置了
registry v2
并使用 nginx
作为反向代理。当我将图像推送到注册表时,出现错误413 Request Entity Too Large
。
我已将 nginx.conf 中的 client_max_body_size 修改为 20MB。推送还是失败。
client_max_body_size 20M;
docker Push 中的 body 大小是多少?如何限制体型?
Docker文档提到应该关闭限制:
http {
...
# disable any limits to avoid HTTP 413 for large image uploads
client_max_body_size 0;
...
}
对于在 Kubernetes 中遇到此错误的任何人,您需要将 此注释 添加到注册表 Ingress 资源:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
您应该将可用内存增加到 300 MB:
client_max_body_size 300M;
重要要点:
server {
# disable any limits to avoid HTTP 413 for large image uploads
client_max_body_size 0;
}
非常感谢楼上的各位