OneGet / MicrosoftDockerProvider

Provider to search, save and install Docker
Other
133 stars 55 forks source link

Error installing docker on Windows Server 2016 behind proxy #14

Open sidviscious opened 7 years ago

sidviscious commented 7 years ago

Trying to install docker on windows server 2016 in a VM. Fails with the below error.

PS C:\Windows\system32> install-package -name docker -providername DockerMsftProvider -Force WARNING: Cannot find path 'C:\Users\TESUSR~1\AppData\Local\Temp\DockerMsftProvider\DockerDefault_DockerSearchIndex.json' because it does not exist. WARNING: Cannot bind argument to parameter 'downloadURL' because it is an empty string. WARNING: The property 'AbsoluteUri' cannot be found on this object. Verify that the property exists. WARNING: The property 'RequestMessage' cannot be found on this object. Verify that the property exists. install-package : No match was found for the specified search criteria and package name 'docker'. Try Get-PackageSource to see all available registered package sources. At line:1 char:1

jayshah-msft commented 7 years ago

Can you please run the command with -Verbose and provide the output?

install-package -name docker -providername DockerMsftProvider -Verbose

Thanks, Jay!

sidviscious commented 7 years ago

Hi Jay, here's the output with verbose option:- PS C:\Windows\system32> install-package -name docker -providername DockerMsftProvider -Force -verbose VERBOSE: Importing package provider 'DockerMsftProvider'. VERBOSE: Using the provider 'DockerMsftProvider' for searching packages. WARNING: Cannot find path 'C:\Users\ADMINI~1\AppData\Local\Temp\DockerMsftProvider\DockerDefault_DockerSearchIndex.json' because it does not exist. WARNING: Cannot bind argument to parameter 'downloadURL' because it is an empty string. WARNING: The property 'AbsoluteUri' cannot be found on this object. Verify that the property exists. WARNING: The property 'RequestMessage' cannot be found on this object. Verify that the property exists. install-package : No match was found for the specified search criteria and package name 'docker'. Try Get-PackageSource to see all available registered package sources. At line:1 char:1

jayshah-msft commented 7 years ago

Can you please provide output of: find-package -name docker -providername DockerMsftProvider -Verbose

sidviscious commented 7 years ago

PS C:\Windows\system32> find-package -name docker -providername DockerMsftProvider -Verbose VERBOSE: Importing package provider 'DockerMsftProvider'. VERBOSE: Using the provider 'DockerMsftProvider' for searching packages. WARNING: Cannot find path 'C:\Users\ADMINI~1\AppData\Local\Temp\DockerMsftProvider\DockerDefault_DockerSearchIndex.json' because it does not exist. WARNING: Cannot bind argument to parameter 'downloadURL' because it is an empty string. WARNING: The property 'AbsoluteUri' cannot be found on this object. Verify that the property exists. WARNING: The property 'RequestMessage' cannot be found on this object. Verify that the property exists. find-package : No match was found for the specified search criteria and package name 'docker'. Try Get-PackageSource to see all available registered package sources. At line:1 char:1

jayshah-msft commented 7 years ago

@sidviscious, Seems like you are not connected to the internet. Can you please confirm you have internet connection on the machine you are facing your error?

dhirschfeld commented 7 years ago

I'm also having this problem - see also: Microsoft/Virtualization-Documentation#434

In my case, I'm behind a proxy.

Changing the below command:

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

to

Install-PackageProvider -Proxy http://MYPROXY:80 -ProxyCredential (Get-Credential) -Name NuGet -MinimumVersion 2.8.5.201 -Force 

worked for me, but I can't see any way to pass proxy credentials for the later Install-Package command to pass through?

Ref: https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/

sidviscious commented 7 years ago

@jayshah-msft I was behind a proxy. Tried it from a different network and it worked Thank you.

dhirschfeld commented 7 years ago

@sidviscious - could you reopen this please? I can't just try another network so I need this to work from behind a corporate proxy.

Until it does, I'm stuck AFAICS...

sidviscious commented 7 years ago

@dhirschfeld reopened it.

dhirschfeld commented 7 years ago

Thx!

dhirschfeld commented 7 years ago

In case it helps anyone else you can manually download and install following the instructions at:

https://msdn.microsoft.com/en-au/virtualization/windowscontainers/docker/configure_docker_daemon

jayshah-msft commented 7 years ago

@dhirschfeld, We have put this on our backlog for January 2017. We will keep this thread posted.

Thanks for your feedback.

Cheers, Jay!

dhirschfeld commented 7 years ago

@jayshah-msft - any update on this - has the timeline slipped?

kethahel99 commented 6 years ago

Use -Proxy flag with your proxy. It works fine

Install-Module DockerProvider -Force -Proxy {http://yourproxyserver:port} and Install-Package Docker -ProviderName DockerProvider -Force -Proxy {http://yourproxyserver:port}

brettjacobson commented 6 years ago

Install-Package Docker does not work when the proxy requires authentication credentials (@kethahel99 says it works with a non-authenticated proxy though). However, https://github.com/OneGet/MicrosoftDockerProvider#not-supported-scenarios says that it's using BITS under the covers which doesn't support proxy (BITS does support a proxy, but NOT authenticated proxies, sigh).

robbmanes commented 4 years ago

I know this looks like a zombie thread right now, but for anyone on Windows 10 who googled and ended up here because of something that looks like this:

PS C:\Windows\system32> Install-Package -Name docker -ProviderName DockerMsftProvider                                                                         Install-Package : Unable to find package providers (DockerMsftProvider).
At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Make sure you check your execution policy as well. Eventually after trying enough things, I listed available package providers and came across this error:

PS C:\Windows\system32> Get-PackageProvider -ListAvailable
WARNING: File C:\Program Files\WindowsPowerShell\Modules\DockerMsftProvider\1.0.0.8\DockerMsftProvider.psm1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
WARNING: File C:\Program Files\WindowsPowerShell\Modules\DockerProvider\0.0.0.3\DockerProvider.psm1 cannot be loaded because running scripts is disabled on
this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, C...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, T...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

And from there, I was able to read about the default execution policy, which is Restricted on Windows 10. Changing it resolved the problem for me:

PS C:\Windows\system32> Get-ExecutionPolicy
Restricted
PS C:\Windows\system32> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

And then it installed with zero problems.

PS C:\Windows\system32>  Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0.02MB
VERBOSE: Free space on the drive: 425448.88MB
VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
C:\Users\robbm\AppData\Local\Temp\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 0 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '19.03.3' from 'DockerDefault'.".
mdrichardson commented 4 years ago

In case anybody else comes across this, I ran into the same error with Windows Server 2016 installed in a Hyper-V session (which I guess counts as a proxy). The fix was to install Powershell Core v7 and it worked just fine.

michaelsync commented 3 years ago

I tried with Powershell 5.1 and Powershell Core v7 on new Windows Server 2016 (Ver 1607 Build: 14393.3443) but still getting the same error.

ramonsmits commented 3 years ago

Had similar issues, solution was [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet
Install-Module DockerMsftProvider -Force
Install-Package Docker -ProviderName DockerMsftProvider -Force

Source: https://stackoverflow.com/questions/45638302/error-trying-to-install-docker-in-windows-server-2016-with-install-module

pavan589 commented 3 years ago

https://stackoverflow.com/a/64654070/14413665 worked for me

slonopotamus commented 2 years ago

You might want to take a look at Stevedore project as a way to install modern Docker for Windows containers on both Windows Server/Client.

Geogboe commented 2 years ago

I had to set a system proxy in the new Windows server settings panel to get this to work with a proxy. The -proxy parameters appears to be getting ignored during the Find-Package step.

Looking at the source code for DockerMsftProvider.psm1 it appears that the provider uses the function Get-HttpResponse to resolve https://go.microsoft.com/fwlink/?LinkID=825636&clcid=0x409 to https://dockermsft.azureedge.net/dockercontainer/DockerMsftIndex.json and this function doesn't take into account a -proxy parameter being passed: https://github.com/OneGet/MicrosoftDockerProvider/blob/68a31d2485a2758273c4f20402fb61afec62dd6e/DockerMsftProvider.psm1#L1167

The function utilizes HttpClient though which does seem to use the system proxy, if it's set. Seems like a simple solution would be to update this function to not ignore -proxy, or to just document that you need to set the system proxy. Is this a bug or by design?

d-duer commented 1 year ago

For anybody that runs into this in the future, the MicrosoftDockerProvider is now deprecated and doesn't work. https://github.com/OneGet/MicrosoftDockerProvider