Connecting to Windows Docker host


I’m having issues connecting from docker container to host VM.

VM image: windows-latest (the public image)
Docker image: aspnet:4.8-windowsservercore-ltsc2019

Integration test setup:
Spins up Http listener in host VM (random port 50 000+) eg 50300
Opens port in Windows firewall
Spins up Windows Server container with a web service
Web service makes a request to Http listener in host VM

Docker network:
docker network create -d nat --gateway --subnet --name integration-tests

docker run --network integration-tests -e LISTENER_ENDPOINT= -p 8080:80 my-web-sample:latest

Observed result:
Github Actions - host is not reachable
Local lab - host is reachable

So I guess I’m skipping some limitation on Github Actions?

1 Like

Hey, @RassK
Could you please add a firewall rule to allow to connect to a port?

    runs-on: windows-latest

      - run: |
          New-NetFirewallRule -DisplayName "Allow port 23456" -Direction Inbound -LocalPort 23456 -Protocol TCP -Action Allow -Profile Any
      - name: Test port 23456
        shell: cmd
        run: |
          start node -e "require('http').createServer(function (req, res) { res.end('OK'); }).listen(23456);"
          docker network create -d nat --gateway --subnet integration-tests
          docker run --network integration-tests curl -v

Yep, my integration tool opens a dynamic port in the firewall for a test runtime. This issue was present also locally, so I could identify it early.

Must be something else :worried:

I don’t think the issue related to github hosted agents, time to start fix opentelemetry-dotnet-instrumentation/AspNetTests.cs at 7cb6863e23671da3d1fa625a76ec210b574c9250 · RassK/opentelemetry-dotnet-instrumentation · GitHub test.

Sorry, I didn’t catch where did you refer?

I’m taking brand new server installation, deploying the code and running tests - all fine.
Running locally in the development machine - all fine.
Running in Github host - no connection between host and container.

@RassK , How do you check connection between docker container & docker host?