title: How can I set a static IP address in a Docker container?
body: <p>I'm perfectly happy with the IP range that docker is giving me by default <code>176.17.x.x</code>, so I don't need to create a new bridge, I just want to give my containers a static address <em>within</em> that range so I can point client browsers to it directly.
  I tried using</p>
  
  <pre><code>RUN echo "auto eth0" &gt;&gt; /etc/network/interfaces
  RUN echo "iface eth0 inet static" &gt;&gt; /etc/network/interfaces
  RUN echo "address 176.17.0.250" &gt;&gt; /etc/network/interfaces
  RUN echo "netmask 255.255.0.0" &gt;&gt; /etc/network/interfaces
  RUN ifdown eth0
  RUN ifup eth0
  </code></pre>
  
  <p>from a Dockerfile, and it properly populated the interfaces file, but the interface itself didn't change. In fact, running ifup eth0 within the container gets this error:</p>
  
  <blockquote>
    <p>RTNETLINK answers: Operation not permitted Failed to bring up eth0</p>
  </blockquote>