ps. I had to scramble some hyperlinks since as a new poster I can only include 2 links, this makes it hard to add references to what I already used as input.
Expected behavior
able to start docker from PowerShell
Actual behavior
docker command not recognized
Information
This actually concerns Windows Server 2019 and not 2016 (I could not pick that from issue type list).
And yes, I restarted my server many times in between these steps (as was also suggested here: Installed today's new version of Docker and now Powershell and bash do not see it. · Issue #920 · docker/for-win · GitHub)
I’m trying to install Docker in process isolation on Windows Server 2019 (I can’t use Hyper-V on this server) when running PowerShell in admin mode.
When I run Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
I however get the error
Get-PackageProvider : A parameter cannot be found that matches parameter name ‘ListAvailableget-packagesource’
I also tried Install-Package -Name docker -ProviderName DockerMsftProvider
I then get:
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], E
xception
+ FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Install-Package : Unable to find package providers (DockerMsftProvider).
At line:3 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], E
xception
+ FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
I then found out that I had to set the PowerShell execution policy to unrestricted like so:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
I also had to temporarily disable some antivirus/malware protection from Windows Defender. For me antimalware was already disabled so I had to also disable real-time virus protection.
I then could run
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Now via Get-PackageProvider -ListAvailable
I see that DockerMsftProvider
is installed.
Name Version DynamicOptions
---- ------- --------------
DockerMsftProvider 1.0.0.8 Update
msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
NuGet 2.8.5.208 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet 1.0.0.1 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent
I ran Install-Package -Name docker -ProviderName DockerMsftProvider
and entered Y
.
I then run Get-Package -Name Docker -ProviderName DockerMsftProvider
and get:
Name Version Source ProviderName
---- ------- ------ ------------
docker 20.10.0 DockerDefault DockerMsftProvider
When I run Install-Package -Name docker -ProviderName DockerMsftProvider
I get no feedback via PowerShell, no errors, so I think it’s good.
However, when I ran docker run --isolation=process mcr.microsoft.com/windows/nanoserver:1809 cmd.exe /c ping 127.0.0.1 -t
I get the error
docker : The term 'docker' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ docker run --isolation=<cant post this link here, see hyperlink above>...
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (docker:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
In the past I had tried to install Docker Desktop, which I then uninstalled since my VPS does not support Hyper-V.
I’m not sure if this is still from that install or new, but I added path C:\Program Files\Docker
to my environment PATH
variable.
Still I get the same error
The term ‘docker’ is not recognized as the name of a cmdlet, function, script file, or operable program.
How can I install Docker?