adjust the docker-start-proxy to take advantage of the linux specific commands that allow contact of localhost (#2971)

Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com>
This commit is contained in:
Azure SDK Bot 2021-10-18 13:32:26 -07:00 committed by GitHub
parent 9dac89c675
commit 5d4024f683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,7 @@ function Get-Proxy-Container(){
$SelectedImage = $LINUX_IMAGE_SOURCE
$Initial = ""
$LinuxContainerArgs = "--add-host=host.docker.internal:host-gateway"
# most of the time, running this script on a windows machine will work just fine, as docker defaults to linux containers
# however, in CI, windows images default to _windows_ containers. We cannot swap them. We can tell if we're in a CI build by
@ -47,6 +48,7 @@ $Initial = ""
if ($IsWindows -and $env:TF_BUILD){
$SelectedImage = $WINDOWS_IMAGE_SOURCE
$Initial = "C:"
$LinuxContainerArgs = ""
}
if ($Mode -eq "start"){
@ -63,8 +65,8 @@ if ($Mode -eq "start"){
# else we need to create it
else {
Write-Host "Attempting creation of Docker host $CONTAINER_NAME"
Write-Host "docker container create -v `"${root}:${Initial}/etc/testproxy`" -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage"
docker container create -v "${root}:${Initial}/etc/testproxy" -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage
Write-Host "docker container create -v `"${root}:${Initial}/etc/testproxy`" $LinuxContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage"
docker container create -v "${root}:${Initial}/etc/testproxy" $LinuxContainerArgs -p 5001:5001 -p 5000:5000 --name $CONTAINER_NAME $SelectedImage
}
Write-Host "Attempting start of Docker host $CONTAINER_NAME"