none
Chocolatey in container with windowsservercore RRS feed

  • Question

  • I want to install chocolatey in container (microsoft/windowsservercore).

    docker run -dti --name=test --net=nat microsoft/windowsservercore cmd

    Use command:

    @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

    But i see a error:

    
    Exception calling "DownloadString" with "1" argument(s): "The request was aborted: Could not create SSL/TLS secure
    channel."
    At line:1 char:1
    + (iex ((new-object net.webclient).DownloadString('https://chocolatey.o ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : WebException


    • Edited by MihaelRF Wednesday, August 31, 2016 11:29 AM
    Wednesday, August 31, 2016 11:27 AM

Answers

  • What user are you running as inside the container? The user manager\containeradministrator?

    I just did a test to block my 443, I got different error msg. So this is something to do with SSL, and certificates, did you mess with your container image somehow? I kind of feel your windowsservercore image was corrupt. Can you remove it and re-pull again?

    • Marked as answer by MihaelRF Wednesday, September 7, 2016 8:55 AM
    Tuesday, September 6, 2016 12:03 PM

All replies

  • Why are you not showing some love to Install-PackageProvider:

    https://technet.microsoft.com/en-us/library/mt676543.aspx

    It's only one simple command to get you Chocolatey, give it a try.

    Friday, September 2, 2016 4:20 PM
  • PS C:\> Install-PackageProvider -name chocolatey -Force

    WARNING: Unable to download the list of available providers. Check your internet connection.

    Install-PackageProvider : No match was found for the specified search criteria for the provider 'chocolatey'. The

    package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.

    At line:1 char:1

    + Install-PackageProvider -name chocolatey -Force

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac

    kageProvider], Exception

    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackagePro

    vider

    PS C:\> Get-PackageProvider -ListAvailable

    Name Version DynamicOptions

    ---- ------- --------------

    msi 3.0.0.0 AdditionalArguments

    msu 3.0.0.0

    PowerShellGet 1.0.0.1 PackageManagementProvider, Type, Scope, InstallUpdate, NoPathUpdate, Filte...

    Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent

    find-module

    NuGet provider is required to continue

    PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet

    provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or

    'C:\Users\ContainerAdministrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet

    provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet

    to install and import the NuGet provider now?

    [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y

    WARNING: Unable to download the list of available providers. Check your internet connection.

    PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider

    'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package

    has the tags.

    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:6679 char:21

    + ... $null = PackageManagement\Install-PackageProvider -Name $script:N ...

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac

    kageProvider], Exception

    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackagePro

    vider

    PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name

    'NuGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.

    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:6685 char:21

    + ... $null = PackageManagement\Import-PackageProvider -Name $script:Nu ...

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo : InvalidData: (NuGet:String) [Import-PackageProvider], Exception

    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProv

    ider

    WARNING: Unable to download the list of available providers. Check your internet connection.

    PackageManagement\Get-PackageProvider : Unable to find package provider 'NuGet'. It may not be imported yet. Try

    'Get-PackageProvider -ListAvailable'.

    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:6689 char:30

    + ... tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet ...

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo : ObjectNotFound: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvi

    der], Exception

    + FullyQualifiedErrorId : UnknownProviderFromActivatedList,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPacka

    geProvider

    find-module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or

    newer version of NuGet provider is installed.

    At line:1 char:1

    + find-module

    + ~~~~~~~~~~~

    + CategoryInfo : InvalidOperation: (:) [Find-Module], InvalidOperationException

    + FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Find-Module

    Monday, September 5, 2016 8:52 AM
  • PS C:\> Install-PackageProvider -Name Chocolatey -Force
    
    Name                           Version          Source           Summary
    ----                           -------          ------           -------
    chocolatey                     2.8.5.130        https://onege... ChocolateyPrototype provider for the OneGet meta-package manager

    Did you notice this in your error msg:

    WARNING: Unable to download the list of available providers. Check your internet connection.

    Monday, September 5, 2016 10:47 AM
  • Yes, I noticed and I know about it. But I have Internet connection in my container. I think than I have problem with SSL.

    Where did you run this command: computer or container?


    Monday, September 5, 2016 3:45 PM
  • In a brand new container out of windowsservercore.

    How did you test Internet access? Does DNS work? Are you behind a corp firewall? Using some kind of proxy?

    Monday, September 5, 2016 3:50 PM
  • On Windows Server 2016 TP5?

    Ping, tracert

    Yes, dns works, I ping google.com. 

    We have no a corp firewall and proxy.

    May be use the transparent network for a container?



    • Edited by MihaelRF Tuesday, September 6, 2016 7:41 AM
    Tuesday, September 6, 2016 7:41 AM
  • I'm running a TP5 VM on Azure. And I'm using NAT, that shouldn't be the problem. I even tried your powershell script at the beginning, that works fine. Just guessing, you probably blocked out going traffic on port 443?

    If you start a new container, and try this:

    curl -Uri https://chocolatey.org/install.ps1 -UseBasicParsing -OutFile install.ps1
    See if you can download this file

    Tuesday, September 6, 2016 10:33 AM
  • :(

    curl : The request was aborted: Could not create SSL/TLS secure channel.At line:1 char:1+ curl -Uri https://chocolatey.org/install.ps1 -UseBasicParsing -OutFil ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

    But I tried this command at the dockerhost, and this command is executed

    Tuesday, September 6, 2016 11:30 AM
  • What user are you running as inside the container? The user manager\containeradministrator?

    I just did a test to block my 443, I got different error msg. So this is something to do with SSL, and certificates, did you mess with your container image somehow? I kind of feel your windowsservercore image was corrupt. Can you remove it and re-pull again?

    • Marked as answer by MihaelRF Wednesday, September 7, 2016 8:55 AM
    Tuesday, September 6, 2016 12:03 PM
  • My great, very very,  the greatest thank you!!! :)

     I remove image. Restart server. And pull image again.

    And all commands worked :)

    Wednesday, September 7, 2016 8:55 AM