title: "RTNETLINK answers: Operation not permitted" during `docker build`
body: <p>I want to build a Docker image with latency+loss on some localhost ports using <code>tc</code> and <code>netem</code>.<br />
  The <code>tc</code> command works on a regular vm, but not in the Dockerfile.</p>
  <p>Here's my Dockerfile:</p>
  <pre><code>FROM ubuntu:16.04
  
  RUN DEBIAN_FRONTEND=&quot;noninteractive&quot; \
      apt-get update --fix-missing &amp;&amp; \
      apt-get -y install \
      apt-utils \
      software-properties-common \
      iproute2
  
  RUN tc qdisc add dev lo root handle 1: htb
  </code></pre>
  <p>I attempt to build it with this command:</p>
  <pre><code>docker build .
  </code></pre>
  <p>But it fails on the RUN command with this error:</p>
  <pre><code>Step 3/3 : RUN tc qdisc add dev lo root handle 1: htb
   ---&gt; Running in 59b27236040b
  RTNETLINK answers: Operation not permitted
  </code></pre>
  <p>I found <a href="https://stackoverflow.com/q/27708376/2037637">this</a>, but my problem occurs during <code>docker build</code>, not <code>docker run</code>. There is no way for me to specify <code>--cap-add</code> because that is not an option for <code>docker build</code>.</p>