title: How to port forward in Docker container?
body: <p>I'd like to forward 8080 port to 80 with iptables in a Docker container.
  In the build I have an error message as you can see below.</p>
  
  <p>Here is the Dockerfile:</p>
  
  <pre><code>FROM fedora
  RUN whoami &amp;&amp; \
   iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
  </code></pre>
  
  <p>Here is the output:</p>
  
  <pre><code>[~]# docker build -t temp /home/edfromhadria/Documents/Docker/temp/.
  Sending build context to Docker daemon 2.048 kB
  Sending build context to Docker daemon 
  Step 0 : FROM fedora
   ---&gt; 834629358fe2
  Step 1 : RUN whoami &amp;&amp;  iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
   ---&gt; Running in 95046cf959bf
  root
  iptables v1.4.21: can't initialize iptables table `nat': Permission denied (you must be root)
  Perhaps iptables or your kernel needs to be upgraded.
  INFO[0001] The command [/bin/sh -c whoami &amp;&amp;  iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080] returned a non-zero code: 3 
  </code></pre>
  
  <p>Thank you in advance for any help you can provide.</p>