我有两个容器,一个运行启动protractor的Node.js进程,另一个运行独立的Selenium容器。该文件如下所示:
version: '2'
services:
www.example.localhost:
build: .
depends_on:
- selenium
dns_search:
- static.example.localhost
extra_hosts:
- "static.example.localhost:127.0.0.1"
ports:
- "3000:3000"
- "4000:4000"
volumes:
- ./src:/code/src
- ./api:/code/api
entrypoint: "npm run"
command: "test:e2e"
selenium:
dns_search:
- selenium.example.localhost
image: selenium/standalone-chrome-debug:2.52.0
environment:
no_proxy: localhost
volumes:
- /dev/urandom:/dev/random
ports:
- "4444:4444"
- "6900:5900"www.example.localhost运行protractor,protractor在protractor.config.js中使用以下代码行连接到selenium容器:
seleniumAddress: "http://selenium:4444/wd/hub",
directConnect: false,当我在selenium容器上运行VNC时,打开容器内的chrome浏览器并输入www.example.localhost:3000,它无法解析该域。但是,当我运行wget www.example.localhost:3000时,它会很好地获得index.html文件。知道我做错了什么吗?
发布于 2016-10-12 08:43:11
结果在谷歌浏览器中,任何以localhost结尾的域名都会解析为127.0.0.1,无论你的域名设置是什么。将域从.localhost更改为.dev可以解决此问题。
https://stackoverflow.com/questions/39135329
复制相似问题