docker-pull.ps1 565 Bytes
Newer Older
1
$images = ""
Stefan Scherer's avatar
Stefan Scherer committed
2 3
if (Test-Path env:docker_images) {
  $images = $env:docker_images.split() 
4 5
}

6 7 8
function DockerPull {
  Param ([string]$image)

9 10 11 12
  if ($image -eq "") {
    return
  }

13 14
  Write-Host Installing $image ...
  $j = Start-Job -ScriptBlock { docker pull $args[0] } -ArgumentList $image
15
  while ( $j.JobStateInfo.state -ne "Completed" -And $j.JobStateInfo.state -ne "Failed" ) {
16
    Write-Host $j.JobStateInfo.state
17
    Start-Sleep 30
18 19 20 21 22 23
  }

  $results = Receive-Job -Job $j
  $results
}

24 25 26
$images | foreach {
  DockerPull $_
}
Stefan Scherer's avatar
Stefan Scherer committed
27 28 29
$images | foreach {
  DockerPull $_
}