无法在Docker容器中使用chcolatey安装软件包

问题描述 投票:0回答:1

我正在构建安装了以下软件的Windows容器

  1. 记事本++
  2. MariaDB
  3. HeidiSQL
  4. 。NET Framework 2.0和3.5

这是我创建的docker映像。https://hub.docker.com/repository/docker/mhhaji/winserver2016_base

我尝试过的事情:

运行容器的步骤

docker run --name mycontainer mhhaji/winserver2016_base:v1 ping -t localhost

docker exec -it mycontainer powershell

一旦powershell运行,我执行以下命令

Get-PackageProvider
#Chocolatey is not existing so I install chocolatey
Find-Package -Provider chocolatey
#Enter [Y] when prompted
#Install notepad++
Find-Package -Provider chocolatey -name notepad*

我收到以下错误

 WARNING: NuGet: The request was aborted: Could not create SSL/TLS secure channel. 

enter image description here

我能够下载Chocolatey,因此连接到外部端点似乎没有问题。

更新:好像我的映像中未安装nuget。正在寻找解决方案,但找不到。

windows powershell docker chocolatey cmdlet
1个回答
0
投票

确保您的系统能够支持TLS 1.2,这是运行巧克力的必要条件

PS> [Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12'

为您的系统启用TLS 1.2

PS> [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12

最后直接从源代码安装Chocolatey

PS> iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'));

© www.soinside.com 2019 - 2024. All rights reserved.