Docker Run: How to Debug Acquire packages/Octopus.DockerPull.ps1?

Need direction on how to debug variables passed into Acquire packages script. Variables Image, DockerUsername, DockerPassword, and FeedUri are not logged when OctopusPrintEvaluatedVariables and OctopusPrintVariables are true.

This is what I’ve tried.

Copied from the Calamari temp folder the Octopus.DockerPull.ps1 and hardcoded the expected values into the script. Script work as expected. Meaning there is variable value problems.

.\Octopus.DockerPull.ps1
Login Succeeded
1.7.6-nanoserver-1809: Pulling from influxdb
Digest: sha256:c886b02b32a60defe848c64217324864737f289b36ba34980eec71cc5a959932
Status: Image is up to date for *******.azurecr.io/influxdb:1.7.6-nanoserver-1809

Problem Message From Tentacle:

Docker version 18.09.6, build 1578dcadd2
 docker pull *******.azurecr.io/influxdb:1.7.6-nanoserver-1809
Calamari.exe : docker : Error response from daemon: Get
https://*******.azurecr.io/v2/influxdb/manifests/1.7.6-nanoserver-1809:
At C:\Octopus\Work\20190703113547-72202-3\Bootstrap.ps1:14 char:1
+ & "${env:TentacleHome}\Calamari\4.15.2\Calamari.exe" download-package …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (docker : Error ...noserver-1809: :String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Process C:\windows\system32\WindowsPowershell\v1.0\PowerShell.exe in C:\Octopus\Work\20190703113547-72202-3 exited with code 1

Octopus.DockerPull.ps1

$IMAGE=$OctopusParameters["Image"]
$dockerUsername=$OctopusParameters["DockerUsername"]
$dockerPassword=$OctopusParameters["DockerPassword"]
$feedUri=$OctopusParameters["FeedUri"]

Write-Verbose $(docker -v)

if (-not ([string]::IsNullOrEmpty($dockerUsername))) {
    # docker 17.07 throws a warning to stderr if you use the --password param
    $dockerVersion = & docker version --format '{{.Client.Version}}'
    $parsedVersion = [Version]($dockerVersion -split '-')[0]
    $dockerNeedsPasswordViaStdIn = (($parsedVersion.Major -gt 17) -or (($parsedVersion.Major -eq 17) -and ($parsedVersion.Minor -gt 6)))
    if ($dockerNeedsPasswordViaStdIn) {
        echo $dockerPassword | docker login --username $dockerUsername --password-stdin $feedUri
    } else {
        docker login --username $dockerUsername --password $dockerPassword $feedUri
    }
    
    if(!$?)
    {
        Write-Error "Login Failed"
        exit 1
    }
}

Write-Verbose "docker pull $IMAGE"
docker pull $IMAGE

Trial & error Found a combination which worked. The Library | External Feeds variable align with the DockerUsername, DockerPassword and FeedUri in the Octopus.DockerPull.ps1. In my case, Registry Path matches with the FeedUri. When I specify Registry Path, even though the host URL matches, it corrected the error.

Great to hear that you got it sorted out @Rob_Livermore!

Hopefully your findings here will help others who may encounter this.

Happy Deployments!