2016-08-25 78 views
2

里面我有两个容器,一个运行的Node.js进程启动量角器,和其他正在运行的独立硒容器。该文件是这样的:域名解析主机上,而不是搬运工容器

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.config.js:

seleniumAddress: "http://selenium:4444/wd/hub", 
directConnect: false, 

当我硒容器上运行VNC ,打开容器中的Chrome浏览器并键入www.example.localhost:3000它无法解析域。但是,当我运行wget www.example.localhost:3000它获得index.html文件就好了。任何想法我做错了什么?

回答

0

原来在谷歌浏览器,在localhost结尾的域名解析为127.0.0.1,不管你有什么DNS设置。将域名从.localhost更改为.dev可修复此问题。