'Cant Reach Docker Container

I am trying to build my microservice project with docker. I can reach vue app but i cant reach my identity service. I tried some small projects with the same dockerfile and compose file it worked. Netstat gives same url i checked that. I tried nearly everthing i see but cant find any solution.

enter image description here

enter image description here

enter image description here

Dockercompose

version: "3.8"
services:
 category:
  container_name: category
  build:
   context: .
   dockerfile: sln/CodeChat-Backend/Category/Dockerfile
  ports: 
   - "7000:7000"  
  depends_on: 
   - redis
  networks:
   - es-network

 gateway:
  container_name: gateway
  build:
   context: .
   dockerfile: sln/CodeChat-Backend/Gateway/Dockerfile
  ports: 
   - "7007:7007"
  depends_on:
  - identity
  - category
  - message
  networks: 
   - es-network

 identity:
  container_name: identity
  restart: always
  build:
   context: .
   dockerfile: sln/CodeChat-Backend/Identity/Dockerfile
  ports: 
   - "7001:7001"
  depends_on:
   - mssql
  networks:
   - es-network
  
 message:
  container_name: message
  build:
   context: .
   dockerfile: sln/CodeChat-Backend/Message/Dockerfile
  ports:
   - "7002:7002"
  depends_on:
   - elasticsearch
   - rabbitmq
   - redis
  networks:
   - es-network
   
 codechat-web:
  container_name: vue
  build:
   context: .
   dockerfile: /Dockerfile
  environment:
   - CHOKIDAR_USEPOLLING=true
  ports:
   - "8081:8080"
  networks:
   - es-network

 elasticsearch:
  image: docker.elastic.co/elasticsearch/elasticsearch:8.0.0
  container_name: elasticsearch
  restart: always
  environment:
   - cluster.name=docker-cluster
   - xpack.security.enabled=false
   - discovery.type=single-node
  ulimits:
     memlock:
       soft: -1
       hard: -1
  ports:
   - "9200:9200"
  networks:
   - es-network
 
 rabbitmq:
  image: rabbitmq:3-management-alpine
  container_name: "rabbitmq"
  ports: 
   - "5672:5672"
   - "15672:15672"
  networks: 
   - es-network

 redis:
  image: redis
  environment:
   - ALLOW_EMPTY_PASSWORD=yes
  ports:
   - "6379:6379"
  networks:
   - es-network

 mssql:
  image: mcr.microsoft.com/mssql/server:2019-latest
  environment:
   SA_PASSWORD: "1576Orhan_"
   ACCEPT_EULA: "Y"
  ports:
   - "1433:1433"
  networks:
   - es-network

networks:
 es-network:
  driver: bridge

Vue dockerfile

FROM node:lts-alpine
RUN npm install -g http-server
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 80
CMD [ "http-server", "dist" ]

Category Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
EXPOSE 80

COPY sln/CodeChat-Backend/Category/*.csproj sln/CodeChat-Backend/Category/
COPY sln/CodeChat-Backend/Core/*.csproj sln/CodeChat-Backend/Core/

RUN dotnet restore sln/CodeChat-Backend/Category/*.csproj
COPY . .
RUN dotnet publish sln/CodeChat-Backend/Category/*.csproj -c Release -o out 

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS runtime
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_URLS http://*:7000
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 7000
ENTRYPOINT ["dotnet","Category.dll"]

Gateway dockerfile

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
EXPOSE 80

COPY sln/CodeChat-Backend/Gateway/*.csproj sln/CodeChat-Backend/Gateway/

RUN dotnet restore sln/CodeChat-Backend/Gateway/*.csproj
COPY . .
RUN dotnet publish sln/CodeChat-Backend/Gateway/*.csproj -c Release -o out 

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS runtime
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_URLS http://*:7007
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 7007
ENTRYPOINT ["dotnet","Gateway.dll"]

Identity dockerfile

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /app
EXPOSE 80

COPY sln/CodeChat-Backend/Identity/*.csproj sln/CodeChat-Backend/Identity/
COPY sln/CodeChat-Backend/Core/*.csproj sln/CodeChat-Backend/Core/

RUN dotnet restore sln/CodeChat-Backend/Identity/*.csproj
COPY . .
RUN dotnet publish sln/CodeChat-Backend/Identity/*.csproj -c Release -o out 

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS runtime
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_URLS http://*:7001
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 7001
ENTRYPOINT ["dotnet","Identity.dll"]

Message dockerfile

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
EXPOSE 80

COPY sln/CodeChat-Backend/Message/*.csproj sln/CodeChat-Backend/Message/
COPY sln/CodeChat-Backend/Core/*.csproj sln/CodeChat-Backend/Core/

RUN dotnet restore sln/CodeChat-Backend/Message/*.csproj
COPY . .
RUN dotnet publish sln/CodeChat-Backend/Message/*.csproj -c Release -o out 

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS runtime
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_URLS http://*:7002
ENV ASPNETCORE_ENVIRONMENT docker
EXPOSE 7002
ENTRYPOINT ["dotnet","Message.dll"]

Gateway ocelot


{
    "Routes": [
        {
        "DownstreamPathTemplate": "/api/category/{everything}",
        "DownstreamScheme": "http",
        "DownstreamHostAndPorts": [
            {
                "Host": "localhost",
                "Port": 7000
            }
        ],
        "UpstreamPathTemplate": "/category/{everything}",
        "UpstreamHttpMethod": [ "GET","POST","PUT","DELETE" ]
        },
        {
            "DownstreamPathTemplate": "/api/user/{everything}",
            "DownstreamScheme": "http",
            "DownstreamHostAndPorts": [
                {
                    "Host": "localhost",
                    "Port": 7001
                }
            ],
            "UpstreamPathTemplate": "/user/{everything}",
            "UpstreamHttpMethod": [ "GET","POST","PUT","DELETE" ]
        },
        {
            "DownstreamPathTemplate": "/api/message/{everything}",
            "DownstreamScheme": "http",
            "DownstreamHostAndPorts": [
                {
                    "Host": "localhost",
                    "Port": 7002
                }
            ],
            "UpstreamPathTemplate": "/message/{everything}",
            "UpstreamHttpMethod": [ "GET","POST","PUT","DELETE" ]
        }
    ],
    "GlobalConfiguration": {
        "BaseUrl": "http://localhost:7007"
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source