for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Not able connect to internet from windows container

Open mmatonok opened this issue 7 years ago • 2 comments

  • [x ] I have tried with the latest version of my channel (Stable or Edge)
  • [x ] I have uploaded Diagnostics
  • Diagnostics ID:92100FF0-9706-4D0E-8108-7201C82494EB/20191115055546

Expected behavior

Container application should be able connect to internet address ( f.e. http://docs.docker.com/)

Actual behavior

After connect to server on internet I am getting below error:

SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond System.Net.Http.ConnectHelper.ConnectAsync(string host, int port, CancellationToken cancellationToken)

HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Information

  • Windows Version: Windows 10.0.18363
  • Docker Desktop Version: 19.03.4 Edge
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: Nope

Steps to reproduce the behavior

  1. Install Docker for Desktop ( Edge), select windows container
  2. in vs 2019/vs 2017, create aspnet core mvc app from Visual studio template Add simple code to simulate connection to internet, example:

using (HttpClient client = new HttpClient()) { try { var data = await client.GetStringAsync(url); ViewData["Message"] = data; } catch(Exception ex) { throw new Exception($"{url} with error.", ex); } }

  1. Works from IISExpress but does not work from container

  2. I tested also

  3. ping and that works: docker run -it --rm alpine:latest ping 8.8.8.8

  4. nslookup: docker run -it --rm alpine:latest nslookup github.com both works fine.

Could be some missing part from my dockerfile?

FROM microsoft/dotnet:2.1-aspnetcore-runtime-nanoserver-1803 AS base WORKDIR /app EXPOSE 80 EXPOSE 443

FROM microsoft/dotnet:2.1-sdk-nanoserver-1803 AS build WORKDIR /src COPY ["WebApplication2/WebApplication2.csproj", "WebApplication2/"] RUN dotnet restore "WebApplication2/WebApplication2.csproj" COPY . . WORKDIR "/src/WebApplication2" RUN dotnet build "WebApplication2.csproj" -c Release -o /app

FROM build AS publish RUN dotnet publish "WebApplication2.csproj" -c Release -o /app

FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "WebApplication2.dll"]

Is any way to track communication from container that container to internet and identify problem?

tnx, Marek

mmatonok avatar Nov 15 '19 06:11 mmatonok

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Feb 13 '20 01:02 docker-robott

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked

docker-robott avatar Jul 11 '20 03:07 docker-robott