Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker push error "413 Request Entity Too Large"

I setup the registry v2 and use nginx as reverse proxy. When I push the image to registy, it error out 413 Request Entity Too Large.

I have modify the client_max_body_size as 20MB in nginx.conf. The push still fails.

client_max_body_size 20M;

What is the body size in docker push? How can I limit the body size?

like image 937
firelyu Avatar asked Feb 01 '16 04:02

firelyu


People also ask

What is 413 Request Entity Too Large?

What does “413 Request Entity Too Large” mean? A 413 HTTP error code occurs when the size of a client's request exceeds the server's file size limit. This typically happens when a client attempts to upload a large file to a web server, and the server responds with a 413 error to alert the client.

How do I fix Nginx 413 Request Entity Too Large?

Error: 413 “Request Entity Too Large” in Nginx with “client_max_body_size” / Changes in Nginx config file. This is happening because of your nginx server not allow to upload file which is larger than defined size in nginx config file.To solve it , you have to modify your nginx configuration.

How does Nginx handle 413 error?

Fixing Error “413 Request Entity Too Large” in Nginx This restrictive limitation is the cause of the “413 Request Entity Too Large” error. To avoid this, you can simply set the client_max_body_size option to a larger value. To accomplish this, you have to edit the /etc/nginx/nginx. conf file.


3 Answers

Docker documentation mentions the limit should be turned off:

http {
    ...
    # disable any limits to avoid HTTP 413 for large image uploads
    client_max_body_size 0;
    ...
}
like image 61
Petr Avatar answered Oct 17 '22 11:10

Petr


For anyone getting this error in Kubernetes you need to add this annotation to the registry Ingress resource:

nginx.ingress.kubernetes.io/proxy-body-size: "0"
like image 43
dvdblk Avatar answered Oct 17 '22 12:10

dvdblk


You should increase the available memory to 300 MB with:

client_max_body_size 300M;
like image 5
songcy Avatar answered Oct 17 '22 10:10

songcy