首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在码头集装箱中使用chcolatey安装软件包

无法在码头集装箱中使用chcolatey安装软件包
EN

Stack Overflow用户
提问于 2020-02-22 23:41:03
回答 1查看 1.4K关注 0票数 0

我正在构建一个windows容器,并安装了以下软件

  1. Notepad++
  2. MariaDB
  3. HeidiSQL
  4. .NET框架2.0和3.5

这是我创建的对接者图像。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运行,我将执行以下命令

代码语言:javascript
复制
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*

我得到以下错误

代码语言:javascript
复制
PS C:\> Find-Package -Provider chocolatey -name notepad* 
WARNING: NuGet: The request was aborted: Could not create SSL/TLS secure channel. 

PS C:\> Find-Package -Provider chocolatey -name mariadb 
Find-Package : No match was found for the specified search criteria and package name 'mariadb' as registered package sources. 
At line:1 char:1 
+ Find-Package -Provider chocolatey -name mariadb 
    + Categorylnfo : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPac
    + FullyQualifiedErrorld : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManage 

PS C:\> Get-PackageSource 
Name          ProviderName    IsTrusted    Location   
chocolatey    Chocolatey      False        http://chocolatey.org/api/v
PSGallery     PowerShellGet   False        https://www.powershellgalle   


PS C:\> Get-PackageParameters
Get-PackageParameters : The term 'Get-PackageParameters' is not recognized as the name 
o program. Check the spelling of the name, or if a path was included, verify that the path 
At line:1 char:1 
+ Get-PackageParameters 
    + Categorylnfo : ObjectNotFound: (Get-PackageParameters:String) [], Command 
    + FullyQualifiedErrorld : CommandNotFoundException 

PS C:\> Get-PackageProvider 
Name           Version         DynamicOptions 
Chocolatey     2.8.5.130       SkipDependencies, ContinueOnFailure, 
ExcludeVersion,ForceX86, PackageSaveMode, FilterOnTag, Contains, 
AllowPrereleaseVersions, Conf  
msi            3.0.0.0         AdditionalArguments  
msu            3.0.0.0 
PowerShellGet  1.0.0.1         PackageManagementProvider, Type, Scope, AllowClobber,SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, DscRes
Programs       3.0.0.0         IncludeWindowsInstaller, IncludeSystemComponent

我能够下载巧克力,所以连接外部端点似乎不是一个问题。

更新:似乎没有安装在我的映像中。寻找解决方案却找不到。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-02-24 01:47:31

确保您的系统能够支持TLS 1.2,因为这是巧克力运行所必需的

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

为您的系统启用TLS 1.2

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

最后直接从源头安装巧克力。

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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60357884

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档