File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,31 @@ if ($Mode -eq "start"){
6464 }
6565 # else we need to create it
6666 else {
67+ $attempts = 0
6768 Write-Host " Attempting creation of Docker host $CONTAINER_NAME "
6869 Write-Host " docker container create -v `" ${root} :${Initial} /etc/testproxy`" $LinuxContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage "
69- docker container create - v " ${root} :${Initial} /etc/testproxy" $LinuxContainerArgs - p 5001 :5001 - p 5000 :5000 -- name $CONTAINER_NAME $SelectedImage
70+ while ($attempts -lt 3 ){
71+ docker container create - v " ${root} :${Initial} /etc/testproxy" $LinuxContainerArgs - p 5001 :5001 - p 5000 :5000 -- name $CONTAINER_NAME $SelectedImage
72+
73+ if ($LASTEXITCODE -ne 0 ){
74+ $attempts += 1
75+ Start-Sleep - s 10
76+
77+ if ($attempts -lt 3 ){
78+ Write-Host " Attempt $attempts failed. Retrying."
79+ }
80+
81+ continue
82+ }
83+ else {
84+ break
85+ }
86+ }
87+
88+ if ($LASTEXITCODE -ne 0 ){
89+ Write-Host " Unable to successfully create docker container. Exiting."
90+ exit (1 )
91+ }
7092 }
7193
7294 Write-Host " Attempting start of Docker host $CONTAINER_NAME "
Original file line number Diff line number Diff line change 66 $(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1
77 displayName: 'Language Specific Certificate Trust'
88
9+ - pwsh : |
10+ docker info
11+ displayName: 'Dump active docker information'
12+
913 - pwsh : |
1014 $(Build.SourcesDirectory)/eng/common/testproxy/docker-start-proxy.ps1 -Mode start -TargetFolder "${{ parameters.rootFolder }}"
1115 displayName: 'Run the docker container'
You can’t perform that action at this time.
0 commit comments