SHA256 not matching while installing docker #15

Open
jaydeepjc opened this Issue Nov 15, 2016 · 43 comments

Comments

Projects
None yet
@jaydeepjc

I am able to find package

Find-Package -providerName DockerMsftProvider -AllVersions

Name Version Source Summary


Docker 1.12.2-cs2-ws... DockerDefault Contains the CS Docker Engine for use with Windows ...

But when I tried to install I am getting SHA256 mismatch error

PS C:> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 40384.86MB
VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
'DockerDefault'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: Verifying Hash of the downloaded file.
WARNING: Cannot verify the file SHA256. Deleting the file.
VERBOSE: Hash verified!
WARNING: C:\Users\ADMINI1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist
Install-Package : Cannot find path
'C:\Users\ADMINI
1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip' because it does not exist.
At line:1 char:1

  • Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
  •   + CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
     eManagement.Cmdlets.InstallPackage
    
    
    

What to Do?

@jayshah-msft

This comment has been minimized.

Show comment
Hide comment
@jayshah-msft

jayshah-msft Nov 15, 2016

Contributor

@jaydeepjc,
Are you using FIPS enabled machine?

Contributor

jayshah-msft commented Nov 15, 2016

@jaydeepjc,
Are you using FIPS enabled machine?

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Nov 16, 2016

@jayshah-msft
No, I am not using FIPS enabled machine, Its simple Windows server 2016 Evalution (Desktop Experience)

jaydeepjc commented Nov 16, 2016

@jayshah-msft
No, I am not using FIPS enabled machine, Its simple Windows server 2016 Evalution (Desktop Experience)

@jayshah-msft

This comment has been minimized.

Show comment
Hide comment
@jayshah-msft

jayshah-msft Nov 23, 2016

Contributor

@nampdn
Can you please run the following commands and provide the output:

Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination /docker.zip

Get-FileHash -Path /docker.zip -Algorithm SHA256

Please provide the output.

Thanks!

Contributor

jayshah-msft commented Nov 23, 2016

@nampdn
Can you please run the following commands and provide the output:

Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination /docker.zip

Get-FileHash -Path /docker.zip -Algorithm SHA256

Please provide the output.

Thanks!

@jayshah-msft

This comment has been minimized.

Show comment
Hide comment
@jayshah-msft

jayshah-msft Nov 29, 2016

Contributor

I see that your SHA256 is as expected and I am glad to see that your install works fine. I would still like to know why your first attempt said SHA did not match.
I will investigate on my end. Let me know if you face any further issues.

Cheers,
Jay!

Contributor

jayshah-msft commented Nov 29, 2016

I see that your SHA256 is as expected and I am glad to see that your install works fine. I would still like to know why your first attempt said SHA did not match.
I will investigate on my end. Let me know if you face any further issues.

Cheers,
Jay!

@jayshah-msft

This comment has been minimized.

Show comment
Hide comment
@jayshah-msft

jayshah-msft Nov 29, 2016

Contributor

@jaydeepjc,
Can you please try to download the file and manually check the SHA?

$destinationFolder = "Path to the destination folder"
Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination $destinationFolder/docker.zip
Get-FileHash -Path $destinationFolder/docker.zip -Algorithm SHA256

Thanks for your help.

Contributor

jayshah-msft commented Nov 29, 2016

@jaydeepjc,
Can you please try to download the file and manually check the SHA?

$destinationFolder = "Path to the destination folder"
Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination $destinationFolder/docker.zip
Get-FileHash -Path $destinationFolder/docker.zip -Algorithm SHA256

Thanks for your help.

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Nov 30, 2016

@jayshah-msft

I can Download and SHA is exactly the same which is in JSON file

    PS C:\> Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination $destinationFolder/docker.zip
   PS C:\> Get-FileHash -Path $destinationFolder/docker.zip -Algorithm SHA256

    Algorithm       Hash                                                                   Path
    ---------       ----                                                                   ----
    SHA256          FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D        C:\test\docker.zip

However when tried to install, issue still persists

    PS C:\> Install-Package -Name docker -ProviderName DockerMsftProvider

    The package(s) come(s) from a package source that is not marked as trusted.
    Are you sure you want to install software from 'DockerDefault'?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
    WARNING: Cannot verify the file SHA256. Deleting the file.
    WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-       ws-beta.zip does not exist
    Install-Package : Cannot find path
    'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip'    because it does not exist.
    At line:1 char:1
    + Install-Package -Name docker -ProviderName DockerMsftProvider
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
+ FullyQualifiedErrorId :    PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
       eManagement.Cmdlets.InstallPackage

jaydeepjc commented Nov 30, 2016

@jayshah-msft

I can Download and SHA is exactly the same which is in JSON file

    PS C:\> Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination $destinationFolder/docker.zip
   PS C:\> Get-FileHash -Path $destinationFolder/docker.zip -Algorithm SHA256

    Algorithm       Hash                                                                   Path
    ---------       ----                                                                   ----
    SHA256          FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D        C:\test\docker.zip

However when tried to install, issue still persists

    PS C:\> Install-Package -Name docker -ProviderName DockerMsftProvider

    The package(s) come(s) from a package source that is not marked as trusted.
    Are you sure you want to install software from 'DockerDefault'?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
    WARNING: Cannot verify the file SHA256. Deleting the file.
    WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-       ws-beta.zip does not exist
    Install-Package : Cannot find path
    'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip'    because it does not exist.
    At line:1 char:1
    + Install-Package -Name docker -ProviderName DockerMsftProvider
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
+ FullyQualifiedErrorId :    PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
       eManagement.Cmdlets.InstallPackage
@DmitryKakurin

This comment has been minimized.

Show comment
Hide comment
@DmitryKakurin

DmitryKakurin Dec 6, 2016

I've had exactly the same problem at first and I've identified the reason: I had a file Get-FileHash.ps1 in my path, and it was called by powershell instead of built-in command.
Since my .ps1 was returning hash in a different format, Install-Package was thinking that hash is incorrect.
The [obvious] fix was to remove my Get-FileHash.ps1.

DmitryKakurin commented Dec 6, 2016

I've had exactly the same problem at first and I've identified the reason: I had a file Get-FileHash.ps1 in my path, and it was called by powershell instead of built-in command.
Since my .ps1 was returning hash in a different format, Install-Package was thinking that hash is incorrect.
The [obvious] fix was to remove my Get-FileHash.ps1.

@jayshah-msft

This comment has been minimized.

Show comment
Hide comment
@jayshah-msft

jayshah-msft Dec 6, 2016

Contributor

@DmitryKakurin,
Thanks for the info. Appreciate your help.
@jaydeepjc, do you have a file named Get-FileHash.ps1 in your path?

Cheers,
Jay!

Contributor

jayshah-msft commented Dec 6, 2016

@DmitryKakurin,
Thanks for the info. Appreciate your help.
@jaydeepjc, do you have a file named Get-FileHash.ps1 in your path?

Cheers,
Jay!

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 6, 2016

@jayshah-msft

I don't have Get-FileHash.ps1 file in my path.

@jayshah-msft

I don't have Get-FileHash.ps1 file in my path.

@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 6, 2016

Contributor

@jaydeepjc, I recommend you change Get-FileHash to Microsoft.PowerShell.Utility\Get-FileHash in DockerMsftProvider.psm1. Relaunch PowerShell to see how it goes.

Contributor

jianyunt commented Dec 6, 2016

@jaydeepjc, I recommend you change Get-FileHash to Microsoft.PowerShell.Utility\Get-FileHash in DockerMsftProvider.psm1. Relaunch PowerShell to see how it goes.

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 7, 2016

@jianyunt

I did the changes you suggested, still problem persists. Is there any way to stop verifying SHA256?

@jianyunt

I did the changes you suggested, still problem persists. Is there any way to stop verifying SHA256?

@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 7, 2016

Contributor

You can, but not recommended.
Can you add something like the following in VerifyHashCheck()/DockerMsftProvider.psm1 line 1651, 1654?
Write-Verbose "$hash $Destination $fileHash"

Write-Verbose "$hash $Destination $fileHash $fileSha256"

Contributor

jianyunt commented Dec 7, 2016

You can, but not recommended.
Can you add something like the following in VerifyHashCheck()/DockerMsftProvider.psm1 line 1651, 1654?
Write-Verbose "$hash $Destination $fileHash"

Write-Verbose "$hash $Destination $fileHash $fileSha256"

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 8, 2016

I did added above lines on mentioned line numbers.

Output is as below,

PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 37105.95MB
VERBOSE: Downloading     https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
 C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-    ws-beta' from
'DockerDefault'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: Verifying Hash of the downloaded file.
VERBOSE: FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
WARNING: Cannot verify the file SHA256. Deleting the file.
VERBOSE: Hash verified!
WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-    beta.zip does not exist
Install-Package : Cannot find path
'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip'     because it does not exist.
 At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
+ FullyQualifiedErrorId :       PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
   eManagement.Cmdlets.InstallPackage

jaydeepjc commented Dec 8, 2016

I did added above lines on mentioned line numbers.

Output is as below,

PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 37105.95MB
VERBOSE: Downloading     https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
 C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-    ws-beta' from
'DockerDefault'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: Verifying Hash of the downloaded file.
VERBOSE: FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
WARNING: Cannot verify the file SHA256. Deleting the file.
VERBOSE: Hash verified!
WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-    beta.zip does not exist
Install-Package : Cannot find path
'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip'     because it does not exist.
 At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
+ FullyQualifiedErrorId :       PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
   eManagement.Cmdlets.InstallPackage
@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 8, 2016

Contributor

Please try adding these and run again. Thanks!
Write-Verbose "hash=$hash"
Write-Verbose "Destination =$Destination"
Write-Verbose "fileHash =$fileHash"
Write-Verbose "fileSha256 =$fileSha256"

Contributor

jianyunt commented Dec 8, 2016

Please try adding these and run again. Thanks!
Write-Verbose "hash=$hash"
Write-Verbose "Destination =$Destination"
Write-Verbose "fileHash =$fileHash"
Write-Verbose "fileSha256 =$fileSha256"

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 9, 2016

Code looks like below, is it correct one which I have written?

    $fileHash = Get-FileHash -Path $Destination `
                            -Algorithm SHA256
    Write-Verbose "hash=$hash"
    Write-Verbose "Destination =$Destination"
    Write-Verbose "fileHash =$fileHash"
    
if($fileHash.Psobject.properties.name -Contains "Hash")
{
    $fileSha256 = $fileHash.Hash
    Write-Verbose "fileSha256 =$fileSha256"
}

OUTPUT is as below

 PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
 VERBOSE: Importing package provider 'DockerMsftProvider'.
 VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
 VERBOSE: Download size: 0MB
 VERBOSE: Free space on the drive: 37091.31MB
 VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
 C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
 VERBOSE: About to download
 VERBOSE: Finished downloading
 VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
 VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
 'DockerDefault'.".

 The package(s) come(s) from a package source that is not marked as trusted.
 Are you sure you want to install software from 'DockerDefault'?
 [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
 VERBOSE: Containers feature is already installed. Skipping the install.
 VERBOSE: Verifying Hash of the downloaded file.
 VERBOSE: hash=FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D
 VERBOSE: Destination =C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
 VERBOSE: fileHash =
 WARNING: Cannot verify the file SHA256. Deleting the file.
 VERBOSE: Hash verified!
 WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist
 Install-Package : Cannot find path
 'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip' because it does not exist.
 At line:1 char:1
 + Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
 + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
 eManagement.Cmdlets.InstallPackage

jaydeepjc commented Dec 9, 2016

Code looks like below, is it correct one which I have written?

    $fileHash = Get-FileHash -Path $Destination `
                            -Algorithm SHA256
    Write-Verbose "hash=$hash"
    Write-Verbose "Destination =$Destination"
    Write-Verbose "fileHash =$fileHash"
    
if($fileHash.Psobject.properties.name -Contains "Hash")
{
    $fileSha256 = $fileHash.Hash
    Write-Verbose "fileSha256 =$fileSha256"
}

OUTPUT is as below

 PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
 VERBOSE: Importing package provider 'DockerMsftProvider'.
 VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
 VERBOSE: Download size: 0MB
 VERBOSE: Free space on the drive: 37091.31MB
 VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
 C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
 VERBOSE: About to download
 VERBOSE: Finished downloading
 VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
 VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
 'DockerDefault'.".

 The package(s) come(s) from a package source that is not marked as trusted.
 Are you sure you want to install software from 'DockerDefault'?
 [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
 VERBOSE: Containers feature is already installed. Skipping the install.
 VERBOSE: Verifying Hash of the downloaded file.
 VERBOSE: hash=FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D
 VERBOSE: Destination =C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
 VERBOSE: fileHash =
 WARNING: Cannot verify the file SHA256. Deleting the file.
 VERBOSE: Hash verified!
 WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist
 Install-Package : Cannot find path
 'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip' because it does not exist.
 At line:1 char:1
 + Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
 + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
 eManagement.Cmdlets.InstallPackage
@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 9, 2016

Contributor

fileHash is null, meaning Get-FileHash returns null. That;s the reason hash does not match.

can you please add the following?

if(-not (Test-Path -Path $Destination))
{
    Write-Verbose  "File $Destination does not exist!!!"
}
 

$fileHash = Get-FileHash -Path $Destination `
                    -Algorithm SHA256


if (-not $fileHash)
{
    Write-Verbose  "fileHash with path is null"
}
 

$fileHash = Get-FileHash -LiteralPath $Destination `
                    -Algorithm SHA256

if (-not $fileHash)
{
    Write-Verbose  "fileHash with LiteralPath is null"
} 
Contributor

jianyunt commented Dec 9, 2016

fileHash is null, meaning Get-FileHash returns null. That;s the reason hash does not match.

can you please add the following?

if(-not (Test-Path -Path $Destination))
{
    Write-Verbose  "File $Destination does not exist!!!"
}
 

$fileHash = Get-FileHash -Path $Destination `
                    -Algorithm SHA256


if (-not $fileHash)
{
    Write-Verbose  "fileHash with path is null"
}
 

$fileHash = Get-FileHash -LiteralPath $Destination `
                    -Algorithm SHA256

if (-not $fileHash)
{
    Write-Verbose  "fileHash with LiteralPath is null"
} 
@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 12, 2016

Below is output

PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 37045.36MB
VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
'DockerDefault'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: Verifying Hash of the downloaded file.
VERBOSE: hash=FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D
VERBOSE: Destination =C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
VERBOSE: fileHash =
VERBOSE: File C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist!!!
VERBOSE: fileHash with path is null
VERBOSE: fileHash with LiteralPath is null
WARNING: Cannot verify the file SHA256. Deleting the file.
VERBOSE: Hash verified!
WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist
Install-Package : Cannot find path
'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip' because it does not exist.
At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
eManagement.Cmdlets.InstallPackage

Below is output

PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 37045.36MB
VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
'DockerDefault'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: Verifying Hash of the downloaded file.
VERBOSE: hash=FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D
VERBOSE: Destination =C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
VERBOSE: fileHash =
VERBOSE: File C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist!!!
VERBOSE: fileHash with path is null
VERBOSE: fileHash with LiteralPath is null
WARNING: Cannot verify the file SHA256. Deleting the file.
VERBOSE: Hash verified!
WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist
Install-Package : Cannot find path
'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip' because it does not exist.
At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package], Exception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
eManagement.Cmdlets.InstallPackage
@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 12, 2016

Contributor

It looks like Get-FileHash returns null on your machine.
Run gcm get-filehash

Contributor

jianyunt commented Dec 12, 2016

It looks like Get-FileHash returns null on your machine.
Run gcm get-filehash

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 13, 2016

PS C:\Users\Administrator> gcm get-filehash

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Get-FileHash                                       3.1.0.0    Microsoft.PowerShell.Utility

jaydeepjc commented Dec 13, 2016

PS C:\Users\Administrator> gcm get-filehash

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Get-FileHash                                       3.1.0.0    Microsoft.PowerShell.Utility
@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 13, 2016

Contributor

hmm... need to debug it.

  1. change Get-FileHash to Microsoft.PowerShell.Utility\Get-FileHash
  2. add "wait-debugger" before Microsoft.PowerShell.Utility\Get-FileHash
  3. save and relaunch powershell
  4. run the install package
  5. launch PowerShell ISE, following the debugging provider instruction to exam each variables mentioned above, such as filehash, Destination, etc.
Contributor

jianyunt commented Dec 13, 2016

hmm... need to debug it.

  1. change Get-FileHash to Microsoft.PowerShell.Utility\Get-FileHash
  2. add "wait-debugger" before Microsoft.PowerShell.Utility\Get-FileHash
  3. save and relaunch powershell
  4. run the install package
  5. launch PowerShell ISE, following the debugging provider instruction to exam each variables mentioned above, such as filehash, Destination, etc.
@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 14, 2016

I debug hash , filehash, destination, filehashsha256 however doesnt get any error message
one ex is as below

PS C:\Windows\system32> Get-PSHostProcessInfo

ProcessName    ProcessId AppDomainName    MainWindowTitle                      
-----------    --------- -------------    ---------------                      
powershell          3160 DefaultAppDomain Administrator: Windows PowerShell    
powershell_ise      4720 DefaultAppDomain Administrator: Windows PowerShell ISE



PS C:\Windows\system32> Enter-PSHostProcess 3160

[Process:3160]: PS C:\Users\Administrator\Documents> Get-Runspace

 Id Name            ComputerName    Type          State         Availability   
 -- ----            ------------    ----          -----         ------------   
  1 Runspace1       localhost       Local         Opened        Available      
  2 Runspace2       localhost       Local         Opened        Available      
  3 Runspace3       localhost       Local         Opened        Available      
  4 Runspace4       localhost       Local         Opened        InBreakpoint   
  5 Runspace5       localhost       Local         Opened        Available      
  6 RemoteHost      localhost       Local         Opened        Busy           



[Process:3160]: PS C:\Users\Administrator\Documents> Debug-Runspace 4
Debugging Runspace: Runspace4
[DBG]: [Process:3160]: [Runspace4]: PS C:\Users\Administrator>> $fileHash


[DBG]: [Process:3160]: [Runspace4]: PS C:\Users\Administrator>> 

I debug hash , filehash, destination, filehashsha256 however doesnt get any error message
one ex is as below

PS C:\Windows\system32> Get-PSHostProcessInfo

ProcessName    ProcessId AppDomainName    MainWindowTitle                      
-----------    --------- -------------    ---------------                      
powershell          3160 DefaultAppDomain Administrator: Windows PowerShell    
powershell_ise      4720 DefaultAppDomain Administrator: Windows PowerShell ISE



PS C:\Windows\system32> Enter-PSHostProcess 3160

[Process:3160]: PS C:\Users\Administrator\Documents> Get-Runspace

 Id Name            ComputerName    Type          State         Availability   
 -- ----            ------------    ----          -----         ------------   
  1 Runspace1       localhost       Local         Opened        Available      
  2 Runspace2       localhost       Local         Opened        Available      
  3 Runspace3       localhost       Local         Opened        Available      
  4 Runspace4       localhost       Local         Opened        InBreakpoint   
  5 Runspace5       localhost       Local         Opened        Available      
  6 RemoteHost      localhost       Local         Opened        Busy           



[Process:3160]: PS C:\Users\Administrator\Documents> Debug-Runspace 4
Debugging Runspace: Runspace4
[DBG]: [Process:3160]: [Runspace4]: PS C:\Users\Administrator>> $fileHash


[DBG]: [Process:3160]: [Runspace4]: PS C:\Users\Administrator>> 
@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 14, 2016

Contributor
  1. So you can confirm after executing (Press F10) Microsoft.PowerShell.Utility\Get-FileHash, it returns null, right?

  2. During the debugging can you check if Docker-1-12-2-cs2-ws-beta.zip exists?
    and run Microsoft.PowerShell.Utility\Get-FileHash c:\....Docker-1-12-2-cs2-ws-beta.zip

  3. you can run Microsoft.PowerShell.Utility\Get-FileHash on your PowerShell console no problem, right? e.g., Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe works?

  4. Just curious, add "$a=Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe" in the DockerMsftProvider.psm1 and check to see if $a is null.
    If $a is not null, get-filehash has no problem. it is likely the docker.zip does not get downloaded.

  5. Also, you may run install-package -debug -verbose ...

  6. install-package -debug -verbose -force

  7. Debugging further
    Can you add wait-debugger in line 280, e.g. right before calling DownloadPackageHelper. then F11 step into DownloadPackageHelper function.
    Watch out the code between line 1428 and 1452.
    Step into the function DownloadFile and check if the code line 1526-1538 executed.

  8. by the way, which OS you are running?
    $PSVersionTable to check your PowerShell Version.

  9. We may need a live meeting with you.

Contributor

jianyunt commented Dec 14, 2016

  1. So you can confirm after executing (Press F10) Microsoft.PowerShell.Utility\Get-FileHash, it returns null, right?

  2. During the debugging can you check if Docker-1-12-2-cs2-ws-beta.zip exists?
    and run Microsoft.PowerShell.Utility\Get-FileHash c:\....Docker-1-12-2-cs2-ws-beta.zip

  3. you can run Microsoft.PowerShell.Utility\Get-FileHash on your PowerShell console no problem, right? e.g., Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe works?

  4. Just curious, add "$a=Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe" in the DockerMsftProvider.psm1 and check to see if $a is null.
    If $a is not null, get-filehash has no problem. it is likely the docker.zip does not get downloaded.

  5. Also, you may run install-package -debug -verbose ...

  6. install-package -debug -verbose -force

  7. Debugging further
    Can you add wait-debugger in line 280, e.g. right before calling DownloadPackageHelper. then F11 step into DownloadPackageHelper function.
    Watch out the code between line 1428 and 1452.
    Step into the function DownloadFile and check if the code line 1526-1538 executed.

  8. by the way, which OS you are running?
    $PSVersionTable to check your PowerShell Version.

  9. We may need a live meeting with you.

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 15, 2016

My OS IS Windows 2016 Server
I have attached the debug file.

  1. I ran wait-debugger again with f10 and found Microsoft.PowerShell.Utility module not found

  2. then ran Import-Module Microsoft.PowerShell.Utility

  3. Then ran Install-package with --debug -verbose

  4. $a= showed null value

  5. Closed poweshell and re-run InstallModule this time $a shows value

  6. Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe works fine, however when tried to check Microsoft.PowerShell.Utility\Get-FileHash c:....Docker-1-12-2-cs2-ws-beta.zip, its not there

  7. My doubt is how come hash file entry shows in verbose mode.

    PS C:\Users\Administrator> $PSVersionTable

     Name                           Value
     ----                           -----
     PSVersion                      5.1.14393.206
     PSEdition                      Desktop
     PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
     BuildVersion                   10.0.14393.206
     CLRVersion                     4.0.30319.42000
     WSManStackVersion              3.0
     PSRemotingProtocolVersion      2.3
     SerializationVersion           1.1.0.1
    

Details are in attached file

Debug.txt

jaydeepjc commented Dec 15, 2016

My OS IS Windows 2016 Server
I have attached the debug file.

  1. I ran wait-debugger again with f10 and found Microsoft.PowerShell.Utility module not found

  2. then ran Import-Module Microsoft.PowerShell.Utility

  3. Then ran Install-package with --debug -verbose

  4. $a= showed null value

  5. Closed poweshell and re-run InstallModule this time $a shows value

  6. Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe works fine, however when tried to check Microsoft.PowerShell.Utility\Get-FileHash c:....Docker-1-12-2-cs2-ws-beta.zip, its not there

  7. My doubt is how come hash file entry shows in verbose mode.

    PS C:\Users\Administrator> $PSVersionTable

     Name                           Value
     ----                           -----
     PSVersion                      5.1.14393.206
     PSEdition                      Desktop
     PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
     BuildVersion                   10.0.14393.206
     CLRVersion                     4.0.30319.42000
     WSManStackVersion              3.0
     PSRemotingProtocolVersion      2.3
     SerializationVersion           1.1.0.1
    

Details are in attached file

Debug.txt

@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 15, 2016

Contributor

I can see two potential issues. Let’s try to isolate problems whether it is related to download zip file issue or Get-FileHash issue.
Step0:
launch a new PowerShell console, Please confirm Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe works for you.

PS C:\> get-module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PSReadlineKeyHandler, ...

PS C:\> Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          BA4038FD20E474C047BE8AAD5BFACDB1BFC1DDBE12F803F473B7918D8D819436       C:\Windows\System32\WindowsPowerShell\v1.0\powers...

Step1:
Close all PowerShell consoles
rename your current MicrosoftDockerProvider under C:\Program Files\WindowsPowerShell\Modules to something else
launch PowerShell
install-module MicrosoftDockerProvider -force -verbose <== this will download the module.

Step 2:
Open the DockerMsftProvider.psm1 from C:\Program Files\WindowsPowerShell\Modules\ and add the following code right after line 1647, i.e. “Write-Verbose "Verifying Hash of the downloaded file."; save it

$a=Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe

if (-not $a)
{
    Write-verbose  "Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe returns null"
}
else
{
    Write-verbose "Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe Successed! $a"
} 

Step 3:
Import-Packageprovider MicrosoftDockerProvider -force -verbose or you can simply relaunch PowerShell Console
Step 4:

Install-package  …. -verbose -force

If $a is null, it is the get-filehash issue on your machine. If $a is not null, It may be the downloading Docker-1-12-2-cs2-ws-beta.zip' issue. let’s continue.

Step 5. Remove the code added in Step 2. Add the following code right after line 1647, i.e. “Write-Verbose "Verifying Hash of the downloaded file."

        if(-not (Test-Path -Path $Destination))
       {
              Write-Verbose  "File $Destination does not exist!!!"
       }

Step6:
Import-Packageprovider MicrosoftDockerProvider -force -verbose
Install-package …. -verbose -force

Please confirm you see the message `File …. Docker-1-12-2-cs2-ws-beta.zip does not exist!!!`.
If so, meaning the Docker-1-12-2-cs2-ws-beta.zip does not get downloaded. Let’s continue.

Step 7:
Looking for “function DownloadFile” in the MicrosoftDockerProvider .psm1. Make changes as suggested below (added write-verbose in 4 places). Save it. Import-Packageprovider MicrosoftDockerProvider -force -verbose
Install-package …. -verbose -force

function DownloadFile
{
    [CmdletBinding()]
    param
    (
        [Parameter(Mandatory=$true)]
        [System.String]
        $downloadURL, 
    
    [Parameter(Mandatory=$true)]
    [System.String]
    $destination
)

try
{

Write-Verbose “downloadURL = $downloadURL”
Write-Verbose “destination = $destination”

    if(-not (CheckDiskSpace -Destination $destination -URL $downloadURL))
    {
 Write-Verbose “failed in CheckDiskSpace!!”
	return
    }

    # Download the file
    if($downloadURL.StartsWith("https://"))
    {
        Write-Verbose "Downloading $downloadUrl to $destination"
        $saveItemPath = $PSScriptRoot + "\SaveHTTPItemUsingBITS.psm1"
        Import-Module "$saveItemPath"
        $startTime = Get-Date
        Write-Verbose "About to download"
        Save-HTTPItemUsingBitsTransfer -Uri $downloadURL `
                        -Destination $destination

        Write-Verbose "Finished downloading"
        $endTime = Get-Date
        $difference = New-TimeSpan -Start $startTime -End $endTime
        $downloadTime = "Downloaded in " + $difference.Hours + " hours, " + $difference.Minutes + " minutes, " + $difference.Seconds + " seconds."
        Write-Verbose $downloadTime
    }
else
{
   Write-Verbose “downloadURL does not StartsWith https!!!”
}
catch
{
    ThrowError -CallerPSCmdlet $PSCmdlet `
                -ExceptionName $_.Exception.GetType().FullName `
                -ExceptionMessage $_.Exception.Message `
                -ExceptionObject $downloadURL `
                -ErrorId FailedToDownload `
                -ErrorCategory InvalidOperation        
}

}

Contributor

jianyunt commented Dec 15, 2016

I can see two potential issues. Let’s try to isolate problems whether it is related to download zip file issue or Get-FileHash issue.
Step0:
launch a new PowerShell console, Please confirm Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe works for you.

PS C:\> get-module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PSReadlineKeyHandler, ...

PS C:\> Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          BA4038FD20E474C047BE8AAD5BFACDB1BFC1DDBE12F803F473B7918D8D819436       C:\Windows\System32\WindowsPowerShell\v1.0\powers...

Step1:
Close all PowerShell consoles
rename your current MicrosoftDockerProvider under C:\Program Files\WindowsPowerShell\Modules to something else
launch PowerShell
install-module MicrosoftDockerProvider -force -verbose <== this will download the module.

Step 2:
Open the DockerMsftProvider.psm1 from C:\Program Files\WindowsPowerShell\Modules\ and add the following code right after line 1647, i.e. “Write-Verbose "Verifying Hash of the downloaded file."; save it

$a=Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe

if (-not $a)
{
    Write-verbose  "Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe returns null"
}
else
{
    Write-verbose "Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe Successed! $a"
} 

Step 3:
Import-Packageprovider MicrosoftDockerProvider -force -verbose or you can simply relaunch PowerShell Console
Step 4:

Install-package  …. -verbose -force

If $a is null, it is the get-filehash issue on your machine. If $a is not null, It may be the downloading Docker-1-12-2-cs2-ws-beta.zip' issue. let’s continue.

Step 5. Remove the code added in Step 2. Add the following code right after line 1647, i.e. “Write-Verbose "Verifying Hash of the downloaded file."

        if(-not (Test-Path -Path $Destination))
       {
              Write-Verbose  "File $Destination does not exist!!!"
       }

Step6:
Import-Packageprovider MicrosoftDockerProvider -force -verbose
Install-package …. -verbose -force

Please confirm you see the message `File …. Docker-1-12-2-cs2-ws-beta.zip does not exist!!!`.
If so, meaning the Docker-1-12-2-cs2-ws-beta.zip does not get downloaded. Let’s continue.

Step 7:
Looking for “function DownloadFile” in the MicrosoftDockerProvider .psm1. Make changes as suggested below (added write-verbose in 4 places). Save it. Import-Packageprovider MicrosoftDockerProvider -force -verbose
Install-package …. -verbose -force

function DownloadFile
{
    [CmdletBinding()]
    param
    (
        [Parameter(Mandatory=$true)]
        [System.String]
        $downloadURL, 
    
    [Parameter(Mandatory=$true)]
    [System.String]
    $destination
)

try
{

Write-Verbose “downloadURL = $downloadURL”
Write-Verbose “destination = $destination”

    if(-not (CheckDiskSpace -Destination $destination -URL $downloadURL))
    {
 Write-Verbose “failed in CheckDiskSpace!!”
	return
    }

    # Download the file
    if($downloadURL.StartsWith("https://"))
    {
        Write-Verbose "Downloading $downloadUrl to $destination"
        $saveItemPath = $PSScriptRoot + "\SaveHTTPItemUsingBITS.psm1"
        Import-Module "$saveItemPath"
        $startTime = Get-Date
        Write-Verbose "About to download"
        Save-HTTPItemUsingBitsTransfer -Uri $downloadURL `
                        -Destination $destination

        Write-Verbose "Finished downloading"
        $endTime = Get-Date
        $difference = New-TimeSpan -Start $startTime -End $endTime
        $downloadTime = "Downloaded in " + $difference.Hours + " hours, " + $difference.Minutes + " minutes, " + $difference.Seconds + " seconds."
        Write-Verbose $downloadTime
    }
else
{
   Write-Verbose “downloadURL does not StartsWith https!!!”
}
catch
{
    ThrowError -CallerPSCmdlet $PSCmdlet `
                -ExceptionName $_.Exception.GetType().FullName `
                -ExceptionMessage $_.Exception.Message `
                -ExceptionObject $downloadURL `
                -ErrorId FailedToDownload `
                -ErrorCategory InvalidOperation        
}

}

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 21, 2016

get-module and Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe working properly as you mention above.
However when I rename C:\Program Files\WindowsPowerShell\Modules to C:\Program Files\WindowsPowerShell\Modules.org

I got below error

PS C:\Users\Administrator> install-module MicrosoftDockerProvider -force -verbose
install-module : The term 'install-module' 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
    + install-module MicrosoftDockerProvider -force -verbose
    + ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (install-module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

get-module and Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe working properly as you mention above.
However when I rename C:\Program Files\WindowsPowerShell\Modules to C:\Program Files\WindowsPowerShell\Modules.org

I got below error

PS C:\Users\Administrator> install-module MicrosoftDockerProvider -force -verbose
install-module : The term 'install-module' 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
    + install-module MicrosoftDockerProvider -force -verbose
    + ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (install-module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 21, 2016

Contributor

Rename C:\Program Files\WindowsPowerShell\Modules\MicrosoftDockerProvider to C:\Program Files\WindowsPowerShell\Modules\MicrosoftDockerProvider .org

Contributor

jianyunt commented Dec 21, 2016

Rename C:\Program Files\WindowsPowerShell\Modules\MicrosoftDockerProvider to C:\Program Files\WindowsPowerShell\Modules\MicrosoftDockerProvider .org

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 22, 2016

There no folder MicroSoftDockerProvider, I renamed DockerMsftProvider to DockerMsftProvider.org

then below Output

 PS C:\Users\Administrator> install-module MicrosoftDockerProvider -force -verbose
 VERBOSE: Using the provider 'PowerShellGet' for searching packages.
 VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
 VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
 VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2/' and   PackageManagementProvider is
 'NuGet'.
 VERBOSE: Searching repository
 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='MicrosoftDockerProvider'' for ''.
 VERBOSE: Total package yield:'0' for the specified package 'MicrosoftDockerProvider'.
 PackageManagement\Install-Package : No match was found for the specified search criteria and module name
 'MicrosoftDockerProvider'. Try Get-PSRepository to see all available registered module repositories.
 At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1661   char:21
 + ...          $null = PackageManagement\Install-Package @PSBoundParameters
 +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install- Package], Ex
    ception
 + FullyQualifiedErrorId :   NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

There no folder MicroSoftDockerProvider, I renamed DockerMsftProvider to DockerMsftProvider.org

then below Output

 PS C:\Users\Administrator> install-module MicrosoftDockerProvider -force -verbose
 VERBOSE: Using the provider 'PowerShellGet' for searching packages.
 VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
 VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
 VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2/' and   PackageManagementProvider is
 'NuGet'.
 VERBOSE: Searching repository
 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='MicrosoftDockerProvider'' for ''.
 VERBOSE: Total package yield:'0' for the specified package 'MicrosoftDockerProvider'.
 PackageManagement\Install-Package : No match was found for the specified search criteria and module name
 'MicrosoftDockerProvider'. Try Get-PSRepository to see all available registered module repositories.
 At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1661   char:21
 + ...          $null = PackageManagement\Install-Package @PSBoundParameters
 +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install- Package], Ex
    ception
 + FullyQualifiedErrorId :   NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 22, 2016

Contributor

install-module DockerMsftProvider -force -verbose

Contributor

jianyunt commented Dec 22, 2016

install-module DockerMsftProvider -force -verbose

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 23, 2016

My Code is

    Write-Verbose "Verifying Hash of the downloaded file."
    $a=Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe
    if (-not $a)
    {
        Write-verbose  "Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe returns null"
    }
    else
    {
        Write-verbose "Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe Successed! $a"
    } 
   $fileHash = Get-FileHash -Path $Destination `
                            -Algorithm SHA256

And below is output

 PS C:\Users\Administrator> Import-Packageprovider DockerMsftProvider -force -verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.

Name                     Version          DynamicOptions
----                     -------          --------------
DockerMsftProvider       1.0.0.1          Update


PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose -force
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 34595.54MB
VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
'DockerDefault'.".
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: Verifying Hash of the downloaded file.
 VERBOSE: Microsoft.PowerShell.Utility\Get-FileHash C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe returns
 null
 WARNING: Cannot verify the file SHA256. Deleting the file.
 VERBOSE: Hash verified!
 WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist
 Install-Package : Cannot find path
 'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip'   because it does not exist.
 At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     ~~~~~
   + CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package],  Exception
  + FullyQualifiedErrorId :   PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
eManagement.Cmdlets.InstallPackage

It look likes get-filehash issue is there

jaydeepjc commented Dec 23, 2016

My Code is

    Write-Verbose "Verifying Hash of the downloaded file."
    $a=Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe
    if (-not $a)
    {
        Write-verbose  "Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe returns null"
    }
    else
    {
        Write-verbose "Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe Successed! $a"
    } 
   $fileHash = Get-FileHash -Path $Destination `
                            -Algorithm SHA256

And below is output

 PS C:\Users\Administrator> Import-Packageprovider DockerMsftProvider -force -verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.

Name                     Version          DynamicOptions
----                     -------          --------------
DockerMsftProvider       1.0.0.1          Update


PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose -force
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 34595.54MB
VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
'DockerDefault'.".
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: Verifying Hash of the downloaded file.
 VERBOSE: Microsoft.PowerShell.Utility\Get-FileHash C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe returns
 null
 WARNING: Cannot verify the file SHA256. Deleting the file.
 VERBOSE: Hash verified!
 WARNING: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip does not exist
 Install-Package : Cannot find path
 'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip'   because it does not exist.
 At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     ~~~~~
   + CategoryInfo          : ObjectNotFound: (C:\Users\ADMINI...cs2-ws-beta.zip:String) [Install-Package],  Exception
  + FullyQualifiedErrorId :   PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand,Microsoft.PowerShell.Packag
eManagement.Cmdlets.InstallPackage

It look likes get-filehash issue is there

@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Dec 23, 2016

Contributor

@KrishnaV-MSFT, @lzybkr, @bmanikm, any ideas why Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe returns null?

Contributor

jianyunt commented Dec 23, 2016

@KrishnaV-MSFT, @lzybkr, @bmanikm, any ideas why Microsoft.PowerShell.Utility\Get-FileHash $pshome\powershell.exe returns null?

@lucassimao01

This comment has been minimized.

Show comment
Hide comment
@lucassimao01

lucassimao01 Dec 26, 2016

1- Download docker
Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination /docker.zip

2- Chek file
Get-FileHash -Path /docker.zip -Algorithm SHA256

3- Copy file for folder docker
cp .\docker.zip C:\Users\Administrator\AppData\Local\Temp\DockerMsftProvider\

4- Get in folder
cd C:\Users\Administrator\AppData\Local\Temp\DockerMsftProvider\

5- Rename file
cp .\docker.zip Docker-1-12-2-cs2-ws-beta.zip

6- Install Docker
Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose

7- reboot VM
Restart-Computer -Force

1- Download docker
Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination /docker.zip

2- Chek file
Get-FileHash -Path /docker.zip -Algorithm SHA256

3- Copy file for folder docker
cp .\docker.zip C:\Users\Administrator\AppData\Local\Temp\DockerMsftProvider\

4- Get in folder
cd C:\Users\Administrator\AppData\Local\Temp\DockerMsftProvider\

5- Rename file
cp .\docker.zip Docker-1-12-2-cs2-ws-beta.zip

6- Install Docker
Install-Package -Name docker -ProviderName DockerMsftProvider -Verbose

7- reboot VM
Restart-Computer -Force

@jaydeepjc

This comment has been minimized.

Show comment
Hide comment
@jaydeepjc

jaydeepjc Dec 27, 2016

PS C:\> Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination dc\docker.zip
PS C:\> cd dc
PS C:\dc> ls


    Directory: C:\dc


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       10/13/2016   5:18 AM       14183015 docker.zip


PS C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider> cp .\docker.zip Docker-1-12-2-cs2-ws-beta.zip
PS C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider> ls


    Directory: C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       10/13/2016   5:18 AM       14183015 Docker-1-12-2-cs2-ws-beta.zip
-a----       10/13/2016   5:18 AM       14183015 docker.zip
-a----       10/13/2016  11:00 PM            589 DockerDefault_DockerSearchIndex.json




PS C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider> Get-FileHash -Path c:\dc\docker.zip -Algorithm SHA256


Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D       C:\dc\docker.zip


PS C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider> Install-Package -Name docker -ProviderName DockerMsft
Provider -Verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 34546.27MB
VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
'DockerDefault'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip already exists.
Skipping save. Use -Force to overwrite.
VERBOSE: Verifying Hash of the downloaded file.
VERBOSE: Microsoft.PowerShell.Utility\Get-FileHash C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe returns
null
VERBOSE: Hash verified!
VERBOSE: Found C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip to install.
VERBOSE: Trying to unzip : C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
VERBOSE: Preparing to expand...
VERBOSE: Created 'C:\Program Files\docker\docker.exe'.
VERBOSE: Created 'C:\Program Files\docker\dockerd.exe'.
VERBOSE: Trying to enable the docker service...
VERBOSE: Removing the archive: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
Install-Package : Cannot rename because item at 'C:\Program Files\dummyName' does not exist.
At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
   Exception
    + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand,Microsoft.PowerShell.Pa
   ckageManagement.Cmdlets.InstallPackage

Post Reboot

  PS C:\Users\Administrator> docker ps
  error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/containers/json: open //./pipe/docker_engine: The
 system cannot find the file specified.
PS C:\> Start-BitsTransfer -Source https://dockermsft.blob.core.windows.net/dockercontainer/docker-1-12-2-cs2-ws-beta.zip -Destination dc\docker.zip
PS C:\> cd dc
PS C:\dc> ls


    Directory: C:\dc


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       10/13/2016   5:18 AM       14183015 docker.zip


PS C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider> cp .\docker.zip Docker-1-12-2-cs2-ws-beta.zip
PS C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider> ls


    Directory: C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       10/13/2016   5:18 AM       14183015 Docker-1-12-2-cs2-ws-beta.zip
-a----       10/13/2016   5:18 AM       14183015 docker.zip
-a----       10/13/2016  11:00 PM            589 DockerDefault_DockerSearchIndex.json




PS C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider> Get-FileHash -Path c:\dc\docker.zip -Algorithm SHA256


Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          FEFEB0CD5566550E9ECAFB87CF26C78AFC8643B2450F2AC0203F6B88BE15B68D       C:\dc\docker.zip


PS C:\Users\Administrator\AppData\Local\Temp\2\DockerMsftProvider> Install-Package -Name docker -ProviderName DockerMsft
Provider -Verbose
VERBOSE: Importing package provider 'DockerMsftProvider'.
VERBOSE: Using the provider 'DockerMsftProvider' for searching packages.
VERBOSE: Download size: 0MB
VERBOSE: Free space on the drive: 34546.27MB
VERBOSE: Downloading https://dockermsft.blob.core.windows.net/dockercontainer/DockerMsftIndex.json to
C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json
VERBOSE: About to download
VERBOSE: Finished downloading
VERBOSE: Downloaded in 0 hours, 0 minutes, 2 seconds.
VERBOSE: Performing the operation "Install Package" on target "Package 'Docker' version '1.12.2-cs2-ws-beta' from
'DockerDefault'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Containers feature is already installed. Skipping the install.
VERBOSE: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip already exists.
Skipping save. Use -Force to overwrite.
VERBOSE: Verifying Hash of the downloaded file.
VERBOSE: Microsoft.PowerShell.Utility\Get-FileHash C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe returns
null
VERBOSE: Hash verified!
VERBOSE: Found C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip to install.
VERBOSE: Trying to unzip : C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
VERBOSE: Preparing to expand...
VERBOSE: Created 'C:\Program Files\docker\docker.exe'.
VERBOSE: Created 'C:\Program Files\docker\dockerd.exe'.
VERBOSE: Trying to enable the docker service...
VERBOSE: Removing the archive: C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-1-12-2-cs2-ws-beta.zip
Install-Package : Cannot rename because item at 'C:\Program Files\dummyName' does not exist.
At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider -Verbos ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
   Exception
    + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand,Microsoft.PowerShell.Pa
   ckageManagement.Cmdlets.InstallPackage

Post Reboot

  PS C:\Users\Administrator> docker ps
  error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/containers/json: open //./pipe/docker_engine: The
 system cannot find the file specified.
@danyhoron

This comment has been minimized.

Show comment
Hide comment
@danyhoron

danyhoron Jan 28, 2017

After hours of digging, I found a hack.
I opened registry editor, and changed the path of the Windows Service (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Docker\ImagePath) to be: C:\Program Files\Docker\dockerd.exe --run-service -H npipe:// -b "none"
After that the service started working.

danyhoron commented Jan 28, 2017

After hours of digging, I found a hack.
I opened registry editor, and changed the path of the Windows Service (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Docker\ImagePath) to be: C:\Program Files\Docker\dockerd.exe --run-service -H npipe:// -b "none"
After that the service started working.

@niranjanch19

This comment has been minimized.

Show comment
Hide comment
@niranjanch19

niranjanch19 May 3, 2017

@danyhoron Can you please explain why did you make this change and what exactly it does?

Did you had any issues with creating nat network with "fixed-cidr" after making the change you mentioned?

@danyhoron Can you please explain why did you make this change and what exactly it does?

Did you had any issues with creating nat network with "fixed-cidr" after making the change you mentioned?

@danyhoron

This comment has been minimized.

Show comment
Hide comment
@danyhoron

danyhoron May 4, 2017

@niranjanch19 I made that change to be able to start the docker service.
It did not worked before that.

I had no issues w/ nat network. Everything worked flawless.

@niranjanch19 I made that change to be able to start the docker service.
It did not worked before that.

I had no issues w/ nat network. Everything worked flawless.

@kagarlickij

This comment has been minimized.

Show comment
Hide comment
@kagarlickij

kagarlickij May 31, 2017

Folks, I've faced the same issue and it turned out that if you execute
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
and it fails you don't have to give up and try to execute the same command a few more times,
for me it had been installed from third or fourth attempt.

Folks, I've faced the same issue and it turned out that if you execute
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
and it fails you don't have to give up and try to execute the same command a few more times,
for me it had been installed from third or fourth attempt.

@gaya3chandran1

This comment has been minimized.

Show comment
Hide comment
@gaya3chandran1

gaya3chandran1 Jun 1, 2017

I too encounter the same error. Any solution?
PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
WARNING: A restart is required to start docker service. Please restart your machine.
WARNING: After the restart please start the docker service.
Install-Package : Cannot rename because item at 'C:\Program Files\dummyName' does not exist.
At line:1 char:1

  • Install-Package -Name docker -ProviderName DockerMsftProvider
  •   + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
     Exception
      + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand,Microsoft.PowerShell.Pa
     ckageManagement.Cmdlets.InstallPackage
    

I too encounter the same error. Any solution?
PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
WARNING: A restart is required to start docker service. Please restart your machine.
WARNING: After the restart please start the docker service.
Install-Package : Cannot rename because item at 'C:\Program Files\dummyName' does not exist.
At line:1 char:1

  • Install-Package -Name docker -ProviderName DockerMsftProvider
  •   + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package],
     Exception
      + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand,Microsoft.PowerShell.Pa
     ckageManagement.Cmdlets.InstallPackage
    
@InteXX

This comment has been minimized.

Show comment
Hide comment
@InteXX

InteXX Jun 24, 2017

The solution, in my case at least, was to modify the Get-HttpResponse() function.

Beginning at line 1133, change this:

1133    $httpClient = New-Object System.Net.Http.HttpClient
1134    $response = $httpclient.GetAsync($Uri)

to this:

1133    $message = New-Object System.Net.Http.HttpRequestMessage
1134    $message.Method = [System.Net.Http.HttpMethod]::Head
1135    $message.RequestUri = $Uri
1136    $httpClient = New-Object System.Net.Http.HttpClient
1137    $response = $httpclient.SendAsync($message)

When the request sends the GET verb, the entire content is downloaded. On low-bandwidth connections such as mine, this results in a timeout. The Response.Result.Content property is null, which causes the subsequent package download to fail.

On the other hand, when we send the HEAD verb only the headers are returned. Since we're only looking for the Content-Length header in order to get the file size, this is all we need.

HTH

InteXX commented Jun 24, 2017

The solution, in my case at least, was to modify the Get-HttpResponse() function.

Beginning at line 1133, change this:

1133    $httpClient = New-Object System.Net.Http.HttpClient
1134    $response = $httpclient.GetAsync($Uri)

to this:

1133    $message = New-Object System.Net.Http.HttpRequestMessage
1134    $message.Method = [System.Net.Http.HttpMethod]::Head
1135    $message.RequestUri = $Uri
1136    $httpClient = New-Object System.Net.Http.HttpClient
1137    $response = $httpclient.SendAsync($message)

When the request sends the GET verb, the entire content is downloaded. On low-bandwidth connections such as mine, this results in a timeout. The Response.Result.Content property is null, which causes the subsequent package download to fail.

On the other hand, when we send the HEAD verb only the headers are returned. Since we're only looking for the Content-Length header in order to get the file size, this is all we need.

HTH

@laoshancun

This comment has been minimized.

Show comment
Hide comment
@laoshancun

laoshancun Jun 6, 2018

any updates? still got Docker-17-06-2-ee-13.zip does not exist on windows server 1709
update on 2018-06-11:
it works fine on windows server 1803.

laoshancun commented Jun 6, 2018

any updates? still got Docker-17-06-2-ee-13.zip does not exist on windows server 1709
update on 2018-06-11:
it works fine on windows server 1803.

@pablodav

This comment has been minimized.

Show comment
Hide comment
@pablodav

pablodav Jun 13, 2018

Got same issue on Windows server 1803, still trying to find a workaround.

Got same issue on Windows server 1803, still trying to find a workaround.

@pablodav

This comment has been minimized.

Show comment
Hide comment
@pablodav

pablodav Jun 13, 2018

What I have confirmed is that the hash is not verified because the file is not at destination, but couldn't find the line that downloads the docker...zip file as it looks like it's not the same as the function that downloads the .json file.

Doing:


$downloadURL = 'https://dockermsft.blob.core.windows.net/dockercontainer/docker-17-06-2-ee-13.zip'
$destination = 'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-17-06-2-ee-13.zip'
Invoke-WebRequest -Uri $downloadURL -OutFile $destination
Install-Package Docker -ProviderName DockerMsftProvider -RequiredVersion $RequiredVersion -Verbose

It will work only without -Force, because -Force flag also removes the file before downloading and then it doesn't downloads there.

File that I have been checking for debugging:

C:\Program Files\WindowsPowerShell\Modules\DockerMsftProvider\1.0.0.4\DockerMsftProvider.psm1

I have never seen the package in the temp folder $destination, looks like some bug in the script doesn't download it or downloads it to some other destination.

pablodav commented Jun 13, 2018

What I have confirmed is that the hash is not verified because the file is not at destination, but couldn't find the line that downloads the docker...zip file as it looks like it's not the same as the function that downloads the .json file.

Doing:


$downloadURL = 'https://dockermsft.blob.core.windows.net/dockercontainer/docker-17-06-2-ee-13.zip'
$destination = 'C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\Docker-17-06-2-ee-13.zip'
Invoke-WebRequest -Uri $downloadURL -OutFile $destination
Install-Package Docker -ProviderName DockerMsftProvider -RequiredVersion $RequiredVersion -Verbose

It will work only without -Force, because -Force flag also removes the file before downloading and then it doesn't downloads there.

File that I have been checking for debugging:

C:\Program Files\WindowsPowerShell\Modules\DockerMsftProvider\1.0.0.4\DockerMsftProvider.psm1

I have never seen the package in the temp folder $destination, looks like some bug in the script doesn't download it or downloads it to some other destination.

@vinicius91

This comment has been minimized.

Show comment
Hide comment
@vinicius91

vinicius91 Jun 28, 2018

First of all I would like to say thank you for all you guys for the info provided in this Issue.
I had the same problems installing Docker on a Windows Server 2016, but unfortunately @pablodav script didn't work for me. I created another one based on the solution that was giben by @danyhoron .

Here is it:
https://github.com/vinicius91/docker-windows-containers/blob/master/PowerShell-Scripts/install_docker_windows_server.ps1

Cheers!!!

vinicius91 commented Jun 28, 2018

First of all I would like to say thank you for all you guys for the info provided in this Issue.
I had the same problems installing Docker on a Windows Server 2016, but unfortunately @pablodav script didn't work for me. I created another one based on the solution that was giben by @danyhoron .

Here is it:
https://github.com/vinicius91/docker-windows-containers/blob/master/PowerShell-Scripts/install_docker_windows_server.ps1

Cheers!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment