docker.local hostname in /etc/hosts not resolving on OSX for docker machine (causing rspec tests to fail)

I had a bug today where my rspec tests ran fine, down to the last expectation, but then I still got a “database connection timeout error”.

This is running rails locally, connecting to a postgres instance inside of docker, using docker machine.

  • Free Docker volume drivers? [closed]
  • Scope of the 'read-only' flag when mounting a volume in Docker
  • Guidance needed - how to track nginx-docker-rails performance issue
  • docker run -it bash -c 'Function from sourced file'
  • Jacoco agent - no output
  • Do I require a load balancer for a web service container in google cloud?
  • Docker machine instructions guided me to create an entry in my /etc/hosts file:

    192.168.99.100 docker.local 
    

    This worked fine for the test itself, but then something (probably some cleanup step after the test suite – possibly from DatabaseCleaner?) still raised an error about timing out connecting to the database.

    After a lot of investigation, debugging, even deleting and recreating the docker machine default container, I finally narrowed it down to if I replace docker.local with the actual IP address in the database config – it passes.

    So bottom line – some cleanup process didn’t have access to the /etc/hosts defined docker.local hostname.

    This is on OSX El Capitan.

  • Is it possible to use docker with jrebel or dcevm
  • Hot to enable swarm containers to connect to the host machine?
  • How can Services running in a Docker VM and running on localhost register at EUREKA dynamically?
  • docker pull failed. manifest invalid: manifest invalid - artifactory
  • Docker + Nodejs + Brunch + ReactJS image
  • passing correct ip via linked docker containers from nginx to jetty
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.