title: Docker-compose containers cannot send request to each other
body: <p>I have two container in docker-compose. 1- Api 2- web
  Webcliet cannot send request to Api directly.web must work on port 80801 https and Api must work on port 8080 http.</p>
  <p>When I open web with https://localhost:80801/ , it goes on debug until web call Api with this address: http://Api:8080 or http://localhost:8080 and I got connection refused.</p>
  <p>Also I cannot open web with https://web:80801/ and http://Api:8080. It gives me dns error.</p>
  <p>docker-compose.override.yml</p>
  <pre><code>version: '3.4'
  
  services:
    Api:
      container_name: Api
      image: Api
      container_name: Api
      hostname: Api
      domainname: Api.test
      environment:
        - ASPNETCORE_ENVIRONMENT=Development
      ports:
        - &quot;8080:8080&quot;
      volumes:
        - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
  
  
    web:
      container_name: web
      image: web
      container_name: web
      hostname: web
      environment:
        - ASPNETCORE_ENVIRONMENT=Development
        - ASPNETCORE_URLS=https://+:80801;http://+:80
        - ASPNETCORE_HTTPS_PORT=80801
      ports:
        - &quot;80801:80801&quot;
  
      volumes:
        - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
        - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
      links:
        - Api
  </code></pre>
  <p>Dockerfile for web</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
  WORKDIR /app
  EXPOSE 80801
  
  FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
  WORKDIR /src
  COPY [&quot;web/web.csproj&quot;, &quot;web/&quot;]
  COPY [&quot;ShopVieweModel/ShopVieweModel.csproj&quot;, &quot;ShopVieweModel/&quot;]
  COPY [&quot;WebFrameWork/WebFrameWork.csproj&quot;, &quot;WebFrameWork/&quot;]
  COPY [&quot;Common/Common.csproj&quot;, &quot;Common/&quot;]
  COPY [&quot;Shop.Data/Shop.Data.csproj&quot;, &quot;Shop.Data/&quot;]
  COPY [&quot;Shop.Entities/Shop.Entities.csproj&quot;, &quot;Shop.Entities/&quot;]
  COPY [&quot;Shop.Core/Shop.Core.csproj&quot;, &quot;Shop.Core/&quot;]
  COPY [&quot;Api/Api.csproj&quot;, &quot;Api/&quot;]
  COPY [&quot;Shop.Ioc/Shop.Ioc.csproj&quot;, &quot;Shop.Ioc/&quot;]
  COPY [&quot;ApiTest/ApiTest.csproj&quot;, &quot;ApiTest/&quot;]
  RUN dotnet restore &quot;web/web.csproj&quot;
  COPY . .
  WORKDIR &quot;/src/web&quot;
  RUN dotnet build &quot;web.csproj&quot; -c Release -o /app/build
  
  FROM build AS publish
  RUN dotnet publish &quot;web.csproj&quot; -c Release -o /app/publish
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app/publish .
  ENTRYPOINT [&quot;dotnet&quot;, &quot;web.dll&quot;]
  </code></pre>
  <p>dockerfile for web</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
  WORKDIR /app
  EXPOSE 8080
  
  FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
  WORKDIR /src
  COPY [&quot;Api/Api.csproj&quot;, &quot;Api/&quot;]
  COPY [&quot;Shop.Entities/Shop.Entities.csproj&quot;, &quot;Shop.Entities/&quot;]
  COPY [&quot;ShopVieweModel/ShopVieweModel.csproj&quot;, &quot;ShopVieweModel/&quot;]
  COPY [&quot;Shop.Ioc/Shop.Ioc.csproj&quot;, &quot;Shop.Ioc/&quot;]
  COPY [&quot;Shop.Core/Shop.Core.csproj&quot;, &quot;Shop.Core/&quot;]
  COPY [&quot;Common/Common.csproj&quot;, &quot;Common/&quot;]
  COPY [&quot;Shop.Data/Shop.Data.csproj&quot;, &quot;Shop.Data/&quot;]
  COPY [&quot;WebFrameWork/WebFrameWork.csproj&quot;, &quot;WebFrameWork/&quot;]
  RUN dotnet restore &quot;Api/Api.csproj&quot;
  COPY . .
  WORKDIR &quot;/src/Api&quot;
  RUN dotnet build &quot;Api.csproj&quot; -c Release -o /app/build
  
  FROM build AS publish
  RUN dotnet publish &quot;Api.csproj&quot; -c Release -o /app/publish
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app/publish .
  ENTRYPOINT [&quot;dotnet&quot;, &quot;Api.dll&quot;]
  
  </code></pre>
  <p>This is  docker ps result</p>
  <pre><code>CONTAINER ID        IMAGE               COMMAND               CREATED             STATUS              PORTS                      NAMES
  95c9b2a21faf        web:dev       &quot;tail -f /dev/null&quot;   15 minutes ago      Up 15 minutes       0.0.0.0:80801-&gt;80801/tcp   web
  df52721a9c07        Api:dev         &quot;tail -f /dev/null&quot;   15 minutes ago      Up 15 minutes       0.0.0.0:8080-&gt;8080/tcp   Api
  </code></pre>
  <p>What is wrong in my configs ?</p>