Docker for Mac和–host选项
我一直在使用Docker for Mac(版本1.12.0-a(build:11213))。
我正在尝试使用图像来运行我的量angular器testing。 我使用这个命令运行testing: docker run -it --privileged --rm --net=host -v /dev/shm:/dev/shm -v $(pwd):/protractor webnicer/protractor-headless src/test/e2e/config/docker-config.js
这是我的configuration文件:
exports.config = { onPrepare: function() { global.nodeModulesPath = '../../main/webapp/node_modules/'; global.mongoConnection = '127.0.0.1:27017'; global.dbName = 'DB_name'; var width = 1280; var height = 768; browser.driver.manage().window().setSize(width, height); }, framework: 'jasmine2', baseUrl: 'http://127.0.0.1:8080/my-app/', specs: ['../tests/**/*.spec.js'], restartBrowserBetweenTests: false, jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, isVerbose: true, includeStackTrace: true } };
Mongo正在容器中运行, webnicer/protractor-headless
容器可以看到Mongo,并可以插入所有数据(我选中了Mongo并通过docker logs
确认)。
但看起来像webnicer/protractor-headless
无法看到部署应用程序的localhost:8080
。
看起来像这是与--net=host
选项,但我不知道。 任何人有一个想法或build议?
从图片页面:
为什么–net =主机?
只有在主机上运行dockerised Protractor对本地主机运行时,此选项才是必需的。 想象一下这个sscenario:你在本地机器上运行一个httptesting服务器,比方说8000端口。你input你的浏览器http:// localhost:8000 ,一切顺利。 然后你想运行相同的本地主机:8000的dockerised量angular器。 如果你不使用–net = host,容器将接收桥接接口和自己的环回,因此容器中的localhost将引用容器本身。 使用–net = host允许容器共享主机的networking堆栈,并在对本地主机运行Protractor时正确引用主机。
- Docker&Angular 2:绑定目录保持空白
- 捕获404并redirect到wwwroot
- Docker – 带有Angular 4模板的ASP.NET Core 2.0
- 混合应用程序中没有使用ion3上的keycloakauthentication
- 当运行在docker和chrome浏览器中的量angular器处于无头模式时,那么得到“元素不可见”
- Angular 2应用程序部署在AWS上运行的Docker容器中
- 三angular帆 – Kubernetes – 找不到docker集装箱
- Dockerized Angular 4和Django编译成功,但localhost:4200不能正常工作
- 需要使用Azure容器registry将angular度种子高级项目部署到Azure应用程序服务