Docker: Install chrome on Windows container using dockerfile

偶尔善良 提交于 2019-12-23 19:23:09

问题


I am trying to install Chrome on my windows container. I've created my docker image with a dockerfile and I would like to install chrome using this dockerfile. I've tried with the following command

RUN apt-get update -qqy \
&& apt-get -qqy install \
xvfb \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

but I have an error (I think it's because I am on windows container and this command is only for unbutu container...) :

'apt-get' is not recognized as an internal or external command,
operable program or batch file.

is there any way to install chrome in a windows container? Or any command to replace 'apt-get' ?

Thanks.


回答1:


Here's a dockerfile I use to install headless chrome into an aspnet 4.5 image. Enjoy.

# extending the `microsoft/aspnet` image.
FROM microsoft/aspnet

RUN echo 'pull down choco'
RUN powershell -Command Install-PackageProvider -name chocolatey -Force
RUN powershell -Command Set-PackageSource -Name chocolatey -Trusted

RUN powershell -Command Get-PackageSource

RUN echo 'install chrome via choco'
RUN powershell -Command Install-Package GoogleChrome -MinimumVersion 74

Another possible route. Copy all your installers into an 'installer directory' next to your dockerfile. Then copy them in and run them manually.

FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
RUN mkdir installers 
COPY ./installers/ /installers
RUN ["c:/installers/ChromeStandaloneSetup64.exe", "/silent", "/install"]
RUN ["c:/installers/Firefox Setup 66.0.3.exe", "-ms"]

Hope this helps... Hope this helps



来源:https://stackoverflow.com/questions/53214937/docker-install-chrome-on-windows-container-using-dockerfile

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