8,330 questions
How to call docker login --password-stdin from a powershell script
Robert Patrick
1
Reputation point
I am trying to write a Powershell script that, among other things, needs to invoke docker login and use the --password-stdin arg to read the password from stdin. Here is what I am trying to do but this clearly doesn't work. Any pointers?
$proc = Write-Output "$IMAGE_REGISTRY_PUSH_PASS" | Start-Process -NoNewWindow -FilePath "$IMAGE_BUILDER_EXE" -ArgumentList "login --username $IMAGE_REGISTRY_PUSH_USER --password-stdin $IMAGE_REGISTRY_HOST" -PassThru
Wait-Process -InputObject $proc
if ($proc.ExitCode -ne 0) {
Write-Error "Failed to log in to the image registry $IMAGE_REGISTRY_HOST"
exit 1
}
Windows for business Windows Server User experience PowerShell
Sign in to answer