title: Shinyproxy - How to pass Hosts to docker image
body: <p>How can I pass the hosts saved in <code>/etc/hosts</code> into the docker image while building it.</p>
  
  <p>I want to do this automatically, so that this snippet works on all server environments.</p>
  
  <p>I tried this in the Dockerfile:</p>
  
  <pre><code>COPY /etc/hosts /etc/hosts
  </code></pre>
  
  <p>But obviously that didnt work with the following error:</p>
  
  <blockquote>
    <p>COPY failed: stat
    /var/lib/docker/tmp/docker-builder736360024/etc/hosts: no such file or
    directory</p>
  </blockquote>
  
  <hr>
  
  <p>I also tried to move the <code>hosts</code> (<code>cp /etc/hosts /app/dir</code>) first in my app-folder and then copying only with in the Dockerfile:</p>
  
  <pre><code>COPY hosts /etc/hosts
  </code></pre>
  
  <p>That didn't throw an error, but looking in a docker container, the container hosts are not the same as the hosting machine.</p>
  
  <hr>
  
  <p>I also tried to build the image with the additional <code>--add-host</code> parameter, but that also did not work.</p>
  
  <p>How can I do this correctly?</p>