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”.
Docker machine instructions guided me to create an entry in my
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.