Skip to content

Commit 078e520

Browse files
azure-sdkscbedd
andauthored
adjust the docker-start-proxy to take advantage of the linux specific commands that allow contact of localhost (Azure#21310)
Co-authored-by: scbedd <[email protected]>
1 parent 1842c21 commit 078e520

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

eng/common/testproxy/docker-start-proxy.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ function Get-Proxy-Container(){
4040

4141
$SelectedImage = $LINUX_IMAGE_SOURCE
4242
$Initial = ""
43+
$LinuxContainerArgs = "--add-host=host.docker.internal:host-gateway"
4344

4445
# most of the time, running this script on a windows machine will work just fine, as docker defaults to linux containers
4546
# however, in CI, windows images default to _windows_ containers. We cannot swap them. We can tell if we're in a CI build by
4647
# checking for the environment variable TF_BUILD.
4748
if ($IsWindows -and $env:TF_BUILD){
4849
$SelectedImage = $WINDOWS_IMAGE_SOURCE
4950
$Initial = "C:"
51+
$LinuxContainerArgs = ""
5052
}
5153

5254
if ($Mode -eq "start"){
@@ -63,8 +65,8 @@ if ($Mode -eq "start"){
6365
# else we need to create it
6466
else {
6567
Write-Host "Attempting creation of Docker host $CONTAINER_NAME"
66-
Write-Host "docker container create -v `"${root}:${Initial}/etc/testproxy`" -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage"
67-
docker container create -v "${root}:${Initial}/etc/testproxy" -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage
68+
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
6870
}
6971

7072
Write-Host "Attempting start of Docker host $CONTAINER_NAME"

0 commit comments

Comments
 (0)