Docker 推送错误“413 Request Entity Too Large”

问题描述 投票:0回答:4

我设置了

registry v2
并使用
nginx
作为反向代理。当我将图像推送到注册表时,出现错误
413 Request Entity Too Large

我已将 nginx.conf 中的 client_max_body_size 修改为 20MB。推送还是失败。

client_max_body_size 20M;

docker Push 中的 body 大小是多少?如何限制体型?

docker-registry
4个回答
55
投票

Docker文档提到应该关闭限制:

http {
    ...
    # disable any limits to avoid HTTP 413 for large image uploads
    client_max_body_size 0;
    ...
}

53
投票

对于在 Kubernetes 中遇到此错误的任何人,您需要将 此注释 添加到注册表 Ingress 资源:

nginx.ingress.kubernetes.io/proxy-body-size: "0"

5
投票

您应该将可用内存增加到 300 MB:

client_max_body_size 300M;

0
投票

重要要点:

  1. 查看您在港口的项目规模(存储是否允许限制)
  2. 正如同事所说,如果你有 1 个或更多 nginx 并且路由经过它们,请写入服务器块(如果你有很多 NGINX,则为块)
server {
    # disable any limits to avoid HTTP 413 for large image uploads
    client_max_body_size 0;
}

非常感谢楼上的各位

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.