Docker:使用dockerfile在Windows容器上安装Chrome [英] Docker: Install chrome on Windows container using dockerfile

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

问题描述

我正在尝试在Windows容器上安装Chrome。我已经使用dockerfile创建了docker映像,并且我想使用该dockerfile安装chrome。我尝试使用以下命令

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/*

但是我有一个错误(我认为这是因为我在Windows容器上,并且此命令仅用于unbutu容器...):

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.

有什么方法可以在Windows容器中安装chrome吗?还是任何替换 apt-get的命令?

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

谢谢。

推荐答案

这是我用来将无头chrome安装到aspnet 4.5映像中的dockerfile。

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

另一种可能的路线。将所有安装程序复制到dockerfile旁边的安装程序目录中。然后复制它们并手动运行它们。

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

这篇关于Docker:使用dockerfile在Windows容器上安装Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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