title: Mac OSX Docker Desktop alpine container cannot communicate with particular host
body: <p>I experience strange behaviour on <code>Mac OSX Docker Desktop</code> when I start a container and try to access a service say at <a href="http://repository.test.example.com/repository" rel="nofollow noreferrer">http://repository.test.example.com/repository</a>. </p>
  
  <p>So I start alpine <code>docker run -it alpine</code> and run command <code>curl http://repository.test.example.com/repository</code> However same service running on another environment 
  <code>http://repository.stage.example.com/repository</code> works.</p>
  
  <p>Verified:</p>
  
  <ol>
  <li>Remote service is running. Using curl on Mac shell works</li>
  <li>Started a Ubuntu VM install docker and checked it works on there too</li>
  <li>Colleague  did not have the same issue</li>
  </ol>
  
  <p>So the issue seems to be related to when container started in Mac OSX directly particularly my Mac.</p>
  
  <p><strong>Commands</strong></p>
  
  <pre class="lang-sh prettyprint-override"><code>docker run -it alpine
  apk add curl
  curl http://repository.test.example.com/repository
  # Does not receive content just hangs until timeout
  </code></pre>
  
  <p><strong>Solution</strong></p>
  
  <p>Realised it has to be something to do with my Docker Desktop. I re-installed but no luck. However I saw my settings for Docker desktop doesn't change. So I needed to remove user settings for Docker Desktop in order to fix it.</p>
  
  <p>Identified any preference files in following folders</p>
  
  <ul>
  <li>ls -l /Users/username/Library/ApplicationSupport | grep -i docker (removing this had no -impact)</li>
  <li>ls -l /Users/username/Library/Preferences | grep -i docker  (removing this had no impact)</li>
  <li>ls -l /Users/username/Library/Containers/ | grep -i docker</li>
  <li>ls -l /Users/username/Library/Group\ Containers/ | grep -i docker</li>
  </ul>
  
  <p>and remove any files and folder. This cleared all the user specific settings and Docker Desktop started fresh. Then the issue is solved as well.</p>
  
  <p>If you need to remove any user settings for application, check and remove relevant files and folders from above directories.</p>
  
  <p>Another useful post <a href="https://stackoverflow.com/questions/410013/where-do-osx-applications-typically-store-user-configuration-data/36725188#36725188">Where do OSX applications typically store user configuration data?</a></p>