microsoft / vscode-dev-containers

NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
https://aka.ms/vscode-remote
MIT License
4.72k stars 1.4k forks source link

Cannot Resolve Host on api.nuget.org From Within Docker-From-Docker-Compose Container on WSL #1471

Open RLashofRegas opened 2 years ago

RLashofRegas commented 2 years ago

Steps to Reproduce:

  1. Open Ubuntu shell via WSL v2
  2. Create new empty directory - mkdir test
  3. Open VS Code in empty directory - code test
  4. Use command palette to invoke "Remote-Containers: Add Development Container Configuration Files..." command
  5. Select "Docker from Docker Compose" container definition and accept all defaults
  6. Use command palette to invoke "Remote-Containers: Reopen in Container" action
  7. Open bash shell and run curl api.nuget.org response is:

    curl: (6) Could not resolve host: api.nuget.org

Additional Notes:

Trying "api.nuget.org" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33132 ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;api.nuget.org. IN A

Received 31 bytes from 127.0.0.11#53 in 10 ms Trying "api.nuget.org" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22994 ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;api.nuget.org. IN AAAA

Received 31 bytes from 127.0.0.11#53 in 0 ms Trying "api.nuget.org" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18793 ;; flags: qr rd; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;api.nuget.org. IN MX

;; ANSWER SECTION: api.nuget.org. 0 IN CNAME nugetapiprod.trafficmanager.net. nugetapiprod.trafficmanager.net. 0 IN CNAME apiprod-mscdn.azureedge.net. apiprod-mscdn.azureedge.net. 0 IN CNAME apiprod-mscdn.afd.azureedge.net. apiprod-mscdn.afd.azureedge.net. 0 IN CNAME star-azureedge-prod.trafficmanager.net. star-azureedge-prod.trafficmanager.net. 0 IN CNAME dual.part-0043.t-0009.t-msedge.net. dual.part-0043.t-0009.t-msedge.net. 0 IN CNAME part-0043.t-0009.t-msedge.net.

Received 239 bytes from 127.0.0.11#53 in 60 ms


$ nslookup -debug api.nuget.org >

Server: 127.0.0.11 Address: 127.0.0.11#53


QUESTIONS:
    api.nuget.org, type = A, class = IN
ANSWERS:
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

Non-authoritative answer:

QUESTIONS:
    api.nuget.org, type = AAAA, class = IN
ANSWERS:
AUTHORITY RECORDS:
ADDITIONAL RECORDS:

*** Can't find api.nuget.org: No answer

RLashofRegas commented 2 years ago

Two more notes that may be relevant:

  1. $ curl api.nuget.org works from the WSL bash shell (i.e. not inside the dev container.
  2. I am not able to reproduce this issue when running Docker for Windows using Hyper-V driver (haven't checked what happens if I switch Windows Docker to use WSL driver)
danieledefrancesco commented 2 years ago

same for me. Any news? Thanks

janivimal commented 2 years ago

Facing same issue with windows container, when trying to ping from within windows container it is not able to resolve dns

image

**note above image is running command from container in -it mode

Livius90 commented 1 year ago

Same for me, also. Any news?

janivimal commented 1 year ago

@Livius90 , finally discovered there was a certificate issue, since I was behind firewall and it was blocking my requests. How this issue was resolved was by using a cert in container and it then used this cert to connect/download nugets and finally it was able to resolve this.