Skip to content

Commit c922bda

Browse files
committed
Add Docker dir to system PATH for ECR credential helper
1 parent 6d7fdba commit c922bda

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packer/windows/scripts/install-docker.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ $docker_plugins_dir = "${env:ProgramFiles}\Docker"
1818
New-Item -ItemType Directory -Force -Path $docker_plugins_dir | Out-Null
1919
Invoke-WebRequest -Uri $ecr_cred_helper_url -OutFile "$docker_plugins_dir\docker-credential-ecr-login.exe"
2020
Write-Output "Amazon ECR credential helper v$ecr_cred_helper_version installed to $docker_plugins_dir"
21+
22+
Write-Output "Adding Docker plugins directory to system PATH..."
23+
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
24+
if ($oldpath -notlike "*$docker_plugins_dir*") {
25+
$newpath = "$docker_plugins_dir;$oldpath"
26+
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newpath
27+
Write-Output "Added $docker_plugins_dir to system PATH"
28+
}

0 commit comments

Comments
 (0)