用nginx作为Docker registry的反向代理

用nginx作为Docker registry的反向代理要注意设置POST请求允许的数据大小,否则推送大的镜像文件会报类似于以下的413错误:

 

Apr  8 22:30:44 localhost docker: Received HTTP code 413 while uploading layer: <html>
Apr  8 22:30:44 localhost docker: <head><title>413 Request Entity Too Large</title></head>
Apr  8 22:30:44 localhost docker: <body bgcolor="white">
Apr  8 22:30:44 localhost docker: <center><h1>413 Request Entity Too Large</h1></center>
Apr  8 22:30:44 localhost docker: <hr><center>nginx/1.6.2</center>
Apr  8 22:30:44 localhost docker: </body>
Apr  8 22:30:44 localhost docker: </html>
Apr  8 22:30:44 localhost docker: time="2015-04-08T22:30:44+08:00" level="info" msg="-job push(docker.homenet/schnell18/gitserver) = ERR (1)"

 设置nginx允许的POST请求数据包大小用:client_max_body_size参数(默认是1m)。比如:

client_max_body_size 200m;

 对于docker registry应用,这参数貌似设置成200M就不会有413错误。

你可能感兴趣的:(docker)