Windows Docker容器上的Chrome无法正常工作 [英] Chrome on Windows docker container is not working

查看:219
本文介绍了Windows Docker容器上的Chrome无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Docker容器上运行Google Chrome.该Docker容器基于 microsoft/windowsservercore:ltsc2016 .我想使用docker容器构建AngularCLI-App.因此,我需要在Google Chrome浏览器中运行测试(并带有– headless标志).

I'm trying to run Google Chrome on a docker container. This docker container is based on the microsoft/windowsservercore:ltsc2016. I want to use the docker container to build an AngularCLI-App. Therefore, I need to run my tests in Google Chrome (with: – headless flag).

使用Chrome运行测试对我来说是一项新功能,因为我的Angular-App不基于Angular CLI结构,并且测试是使用PhantomJS执行的.

Running tests with Chrome is a new feature for me, because my Angular-Apps are not based on an Angular CLI structure and the tests were executed with PhantomJS.

我已经更新了整个Angular-Project,使其适合AngularCLI结构,因为我希望它们基于标准的Angular方式.因此,我尝试使用Chrome而不是PhantomJS.

I have updated my whole Angular-Project to fit in an AngularCLI-structure, because I want them to base on a standard Angular way. So I'm trying to use Chrome instead of PhantomJS.

此外,我正在使用Chocolatey安装软件包.

Moreover, I'm using chocolatey to install packages.

这是我缩小的dockerfile:

Here is my minified dockerfile:

FROM microsoft/windowsservercore:ltsc2016

RUN choco install -y googlechrome && \
    choco install -y nodejs --version 8.11.3

# npm konfiguration um den dvelop-npm ProGet feed nutzen zu können
RUN npm install -g @angular/cli

我可以使用完整的dockerfile构建AngularApp,但是我的测试无法正常工作.在启动Chrome的过程中出现错误,该错误表明chrome.dll中找不到Chrome的一个模块.

I'm able to build the AngularApp with my full dockerfile, but my tests aren't working. During starting Chrome there appears an error, which says that one module of Chrome could not be found inside the chrome.dll.

完整错误:

Project name: dapi-provider
22 10 2018 11:16:09.393:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
22 10 2018 11:16:09.396:INFO [launcher]: Launching browser ChromeHeadlessNoSandbox with unlimited concurrency
22 10 2018 11:16:09.410:INFO [launcher]: Starting browser Chrome
22 10 2018 11:16:10.238:ERROR [launcher]: Cannot start Chrome
        [1022/111609.595:ERROR:main_dll_loader_win.cc(134)] Failed to load Chrome DLL from C:\Program Files (x86)\Google\Chrome\Application\70.0.3538.67\chrome.dll: The specified module could not be found. (0x7E)

推荐答案

我知道这是一个较晚的回复-但几周前,我本人还是在同一条船上.

I know this is a late response - but I was in the same boat myself a couple of weeks ago.

原来-问题是字体.是的,图大声笑.

It turns out - the issue is Fonts. Yeah go figure lol.

ServerCore仅包含一种字体,而不包含Google chrome呈现UI所需的字体.

ServerCore only contains one font, and not the fonts required by google chrome to render the UI.

我在这里为您整理了所需的字体,并显示了如何在Windows容器中提取和安装: https://github.com/prom3theu5/ServerCoreFonts

I've put together the required fonts here for you, and shown how to extract and install in the windows container: https://github.com/prom3theu5/ServerCoreFonts

所需字体:

  • Arial
  • Consolas
  • Times New Roman

这篇关于Windows Docker容器上的Chrome无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆