title: Docker Ignores limits.conf (trying to solve "too many open files" error)
body: <p>I'm running a web server that is handling many thousands of concurrent web socket connections. For this to be possible, on Debian linux (my base image is google/debian:wheezy, running on GCE), where the default number of open files is set to 1000, I usually just set the ulimit to the desired number (64,000). </p>
  
  <p>This works out great, except that when I dockerized my application and deployed it - I found out that docker kind of ignores the limit definitions. I have tried the following (all on the host machine, not on the container itself):</p>
  
  <pre><code>MAX=64000
  sudo bash -c "echo \"* soft nofile $MAX\" &gt;&gt; /etc/security/limits.conf"
  sudo bash -c "echo \"* hard nofile $MAX\" &gt;&gt; /etc/security/limits.conf"
  sudo bash -c "echo \"ulimit -c $MAX\" &gt;&gt;  /etc/profile"
  ulimit -c $MAX
  </code></pre>
  
  <p>After doing some research I found that people were able to solve a similar issue by doing this:</p>
  
  <pre><code>sudo bash -c "echo \"limit nofile 262144 262144\" &gt;&gt; /etc/init/docker.conf"
  </code></pre>
  
  <p>and rebooting / restarting the docker service. </p>
  
  <p>However, all of the above fail: I am getting the "too many open files" error when my app runs inside the container (doing the following without docker solves the problem). </p>
  
  <p>I have tried to run <code>ulimit -a</code> inside the container to get an indication if the ulimit setup worked, but doing so throws an error about ulimit not being an executable that's a part of the PATH. </p>
  
  <p>Anyone ran into this and/or can suggest a way to get docker to recognzie the limits?</p>