在Docker中运行Lightttpd:ulimits not honored

我正在尝试在Docker容器中运行lighttpd(1.4.35),以便为大容量静态网站(无PHP等)提供服务。 运行一分钟后,错误日志将填充:

(server.c.1444)[note]套接字被禁用,达到连接限制

我已经在/etc/security/limits.conf (并重新启动)中提高了root的限制:

 root soft nofile 4096 root hard nofile 32768 

在我docker-compose.yml (相当于命令行中的--ulimit ):

 ulimits: nofile: soft: 4096 hard: 32768 

在我的lighttpd.conf

 server.max-fds = 8192 server.max-connections = 4096 

但是当我运行lsof -n | grep -c lighttpd lsof -n | grep -c lighttpd我得到不高于128.如果我进入容器并运行ulimit -n我得到4096,如预期的那样。 运行ulimit -a返回:

 core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 128490 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 4096 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) unlimited virtual memory (kbytes, -v) unlimited file locks (-x) unlimited 

我还有什么遗漏? 我如何获得lighttpd接受超过128个连接?