34

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?

Raktim Biswas
  • 4,011
  • 5
  • 27
  • 32
firelyu
  • 2,102
  • 5
  • 25
  • 29

3 Answers3

49

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;
    ...
}
Petr
  • 856
  • 7
  • 8
  • 7
    Disappointing there isn't a better fix when the [protocol](https://docs.docker.com/registry/spec/api/#/blob-upload) supports chunked uploads. – Phil Lello Dec 17 '16 at 17:38
45

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"
David
  • 2,109
  • 1
  • 22
  • 27
5

You should increase the available memory to 300 MB with:

client_max_body_size 300M;
Martin Zabel
  • 3,589
  • 3
  • 19
  • 34
songcy
  • 61
  • 5
  • Images can be easily larger than 300M. It is better to turn off the limit: `client_max_body_size 0;` – Petr Nov 14 '16 at 22:22