Docker:使用dockerfile在Windows容器上安装chrome

Docker:使用dockerfile在Windows容器上安装chrome,docker,dockerfile,docker-container,docker-image,docker-for-windows,Docker,Dockerfile,Docker Container,Docker Image,Docker For Windows,我正在尝试在我的windows容器上安装Chrome。我已经用dockerfile创建了我的docker映像,我想用这个dockerfile安装chrome。我已尝试使用以下命令 RUN apt-get update -qqy \ && apt-get -qqy install \ xvfb \ && rm -rf /var/lib/apt/lists/* /var/cache/apt/* 但我有一个错误(我想这是因为我在windows容器上,并且此命令仅用于u

我正在尝试在我的windows容器上安装Chrome。我已经用dockerfile创建了我的docker映像,我想用这个dockerfile安装chrome。我已尝试使用以下命令

RUN apt-get update -qqy \
&& apt-get -qqy install \
xvfb \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
但我有一个错误(我想这是因为我在windows容器上,并且此命令仅用于unbutu容器…):

有没有办法在windows容器中安装chrome?或任何替换“apt get”的命令


谢谢

这是一个dockerfile,我用来将无头chrome安装到aspnet 4.5映像中。享受

# 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旁边的“安装程序目录”中。然后将它们复制到中并手动运行

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"]
希望这有助于。。。
希望这有帮助

您可以在此处查看:您好,感谢您的评论,我查看了Chocolate,可能找到了解决方案,以下是我使用Chocolate的代码摘录:
运行powershell-命令iex((new object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));运行choco install-y googlechrome
但最后我有一个错误:命令
'cmd/S/C choco install-y googlechrome'返回一个非零代码:4294967295
你能试试
choco install googlechrome吗?忽略校验和
我能问你为什么吗正在尝试在Windows容器上安装Chrome(或任何与GUI相关的东西)?还是仅针对Chrome Headless?谢谢Joe。
-RequiredVersion 73
(目前已过时)不适用于此方法,因此不确定任何开关在这里是否重要。是否有方法安装特定版本?看起来Chocolate总是安装msi(它总是安装最新版本)对于较旧版本的chrome,。因此,在较不美观/简单地安装较旧版本后,可能还需要禁用google update services a la
Get Service gupdate*| Stop Service
。@主观真实性-使用-MinimumVersion 73-MaximumVersion 73如何?我现在无法在这里测试,因为我们的代理程序炒了我。我不知道我想它会按照……上的说明工作。
这个软件包总是安装最新版本的Google Chrome,不管软件包中指定的版本如何。Google没有正式提供较旧版本的Chrome供下载。
你可以找到73的安装程序,把它放在一个“侧目录”中,然后把它推到你的图片中?我有由于某些代理问题,今天无法执行此操作。从mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019运行mkdir安装程序复制/installers//installers运行[“c:/installers/ChromeStandaloneSetup64.exe”、“/silent”、“/install”]运行[“c:/installers/Firefox Setup 66.0.3.exe”、“-ms”]
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"]