title: How can I add DNS entries to hosts file of a Windows Container?
body: <p>I have a website in IIS of my host machine which is accessible by <a href="http://mysite.local" rel="nofollow noreferrer">http://mysite.local</a> address. I also have a windows container running on this host and I'm trying to connect to that website, from my windows container by using &quot;curl http://mysite.local&quot;.</p>
  <p>I'm going to add the proper DNS entry to hosts file of the container. To do so, I connect to command shell of the container and run the following command:</p>
  <pre><code>echo 192.168.0.144 mysite.local &gt;&gt; c:\windows\system32\drivers\etc
  </code></pre>
  <p>But the console shows &quot;<em>Access is denied.</em>&quot;</p>
  <p>So basically, my question is:</p>
  <ul>
  <li>How can I add DNS entries to hosts file of a Windows Container?</li>
  </ul>
  <p>I'm using <code>Docker Desktop version 2.3.0.4(46911)</code>, having <code>Engine version 19.03.12</code> on <code>Windows 10</code>.<br />
  I've created the container using <code>mcr.microsoft.com/windows/servercore:ltsc2019</code> as windows base image, also tried <code>nanoserver:1903</code>.</p>