- I have a Node app running locally with Express + React + etc.
- I have an /etc/hosts entry mapping 127.0.0.1 to a necessary hostname
127.0.0.1 really.important.mycompany.com
- I have a standalone Docker image running selenium with standalone Chrome (https://hub.docker.com/r/selenium/standalone-chrome/)
- I have a webdriverio (http://webdriver.io/) suite of tests that need to run against the really.important.mycompany.com local hostname.
- I start the Docker image with:
docker run --name mycompany-selenium --add-host -d --rm -p 4444:4444 selenium/standalone-chrome
- I start the local Node app with
webpack-dev-server --hot --config webpack.dev.js
- I try to run the webdriverio suite with
./node_modules/.bin/wdio wdio.conf.js --baseUrl https://really.important.mycompany.com
The selenium server doesn't seem to be able to hit the /etc/host entry on my host computer. Is there an easy way to do this?
- Using docker.for.mac.localhost instead of the really.important.mycompany.com but like I said the hostname is vital for our app to run.
- A bunch of different stuff with the
docker run
command like--add-host localhost.adobecc.com:10.0.2.2
but it doesn't seem to help.
Have you tried some of the solutions from this thread? https://forums.docker.com/t/access-host-not-vm-from-inside-container/11747/20
If
docker.for.mac.localhost
works, have you checked out what IP does that resolve to and see if--add-host
for the company hostname with that IP would work?Since the container is in its own network namespace inside of a VM running on a virtual network managed by vpnkit (IIRC), you'll need funny networking magic in one form or another.