Chrome on Windows docker container is not working

会有一股神秘感。 提交于 2021-01-24 07:03:28

问题


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).

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.

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.

Moreover, I'm using chocolatey to install packages.

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

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.

Full error:

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)

回答1:


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 only contains one font, and not the fonts required by google chrome to render the UI.

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

Required Fonts:

  • Arial
  • Consolas
  • Times New Roman


来源:https://stackoverflow.com/questions/52948655/chrome-on-windows-docker-container-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!