Issue
Failed to install docker package with error: install-package : Cannot rename because item at ‘C:\Program Files\dummyName’ does not exist.
Symptoms
- Docker package installation failed with error ” install-package : Cannot rename because item at ‘C:\Program Files\dummyName’ does not exist.”
- Created ‘dummyName’ folder in location ‘ C:\Program Files\’, still the package installation failed with same error
Summary
Started installing Docker Module
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
Install-Module DockerMsftProvider -Force
install-package docker -ProviderName DockerMsftProvider -Force
install-package : Cannot rename because item at ‘C:\Program Files\dummyName’ does not exist.
At line:1 char:1
+ install-package docker -ProviderName DockerMsftProvider -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power….InstallPackage:InstallPackage) [Install-Package],
Exception
+ FullyQualifiedErrorId : InvalidOperation
Cause
Work around timing issue between unzip and rename folder
Solution
# Rename the docker folder to become Docker
$dummyName = 'dummyName'
$null = Rename-Item -Path $script:pathDockerRoot -NewName $env:ProgramFiles\$dummyName
while (!(Test-Path $env:ProgramFiles\$dummyName))
{
Start-Sleep 1
$null = Rename-Item -Path $script:pathDockerRoot -NewName $env:ProgramFiles\$dummyName -ErrorAction Continue -Verbose
}
$null = Rename-Item -Path $env:ProgramFiles\$dummyName -NewName $script:pathDockerRoot
Reference
https://github.com/OneGet/MicrosoftDockerProvider/pull/62/files