socket失败打开文件太多错误Docker

时间:2014-12-25 15:14:04

标签: php linux nginx centos docker

在我使用CentOS 6.6运行的Docker容器中,我收到以下错误:

2014/12/25 15:09:07 [alert] 319#0: *2030 socket() failed (24: Too many open files) while connecting to upstream, client: 127.0.0.1, server: test.org.au, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:80/", host: "127.0.0.1"
2014/12/25 15:09:07 [crit] 319#0: *2030 open() "/usr/share/nginx/html/50x.html" failed (24: Too many open files), client: 127.0.0.1, server: test.org.au, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:80/", host: "127.0.0.1"

我在主机上运行的Docker版本是1.3.3

我试图在Docker容器中设置ulimit,但我得到了以下内容:

[root@test ~]# sysctl -p
error: "Read-only file system" setting key "net.ipv4.ip_forward"
error: "Read-only file system" setting key "net.ipv4.conf.default.rp_filter"
error: "Read-only file system" setting key "net.ipv4.conf.default.accept_source_route"
error: "Read-only file system" setting key "kernel.sysrq"
error: "Read-only file system" setting key "kernel.core_uses_pid"
error: "net.ipv4.tcp_syncookies" is an unknown key
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
error: "Read-only file system" setting key "kernel.msgmnb"
error: "Read-only file system" setting key "kernel.msgmax"
error: "Read-only file system" setting key "kernel.shmmax"
error: "Read-only file system" setting key "kernel.shmall"
error: "Read-only file system" setting key "fs.file-max"

当我尝试在浏览器中查看网址时,我收到500内部服务器错误。

我也在运行LEMP(Nginx,MySQL和PHP-FPM)堆栈。

有人对这个问题有一些建议吗?

1 个答案:

答案 0 :(得分:2)

您可以增加将ulimit -n 65536添加到文件/etc/init.d/docker的泊坞窗服务的打开文件限制。