No Internet Connectivity in docker-windows container

I’m using windows servercore:1809 to build a windows container.

I’m also behind a http-proxy along with vpn. Now when I try to check the internet connectivity with a simple curl request I get

C:\>curl -v -L -o git.exe https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.1/Git-2.47.1-64-bit.exe
* Uses proxy env variable no_proxy == 'auth,localhost,27.0.0.1,.company.com,*.company.com,.company.com,*.company.com'
* Uses proxy env variable https_proxy == 'http://username:password@proxy.company.com:3128'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Host proxy.company.com:3128 was resolved.
* IPv6: (none)
* IPv4: XX.0.1.10, XX.0.1.18
*   Trying XX.0.1.10:3128...
* Connected to proxy.company.com (XX.0.1.10) port 3128
* CONNECT tunnel: HTTP/1.1 negotiated
* allocate connect buffer
* Proxy auth using Basic with user 'username'
* Establish HTTP proxy tunnel to github.com:443
> CONNECT github.com:443 HTTP/1.1
> Host: github.com:443
> Proxy-Authorization: Basic Y2VuZG1hMzptbXXXXXX
> User-Agent: curl/8.9.1
> Proxy-Connection: Keep-Alive
>
< HTTP/1.0 200 Connection Established
<
* CONNECT phase completed
* CONNECT tunnel established, response 200
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* Recv failure: Connection was reset
* schannel: failed to receive handshake, SSL/TLS connection failed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* closing connection #0
curl: (35) Recv failure: Connection was reset

and I see all the proxy env variables set and being used correctly

But I still cannot access internet inside the container
and with the same proxy everything works fine on windows native cmd.

Could anyone please tell me where I’m going wrong?

I’m wondering if what you are experiencing (Connection was reset from within the container) is a difference between TLS settings on the host vs the container. Perhaps the container is restricted to older TLS versions whereas the host allows newer versions (like TLS 1.3) and that is why the host is successful. You should be able to chase down those settings with a req query command on both the host and container sides to see if there is a discrepancy that explains your issue.