Im new to Docker and im trying to set up 2 containers, one running mongoDB and one running the web application.
The problem is that I can not access my .NET core application via localhost:5000 or 0.0.0.0:5000.
Mongo is running fine.
Here is my docker-compose.yml
version: '3'
services:
web:
build: .
ports:
- "5000:5000"
mongo:
build: ../../../docker/wishare-mongo/
volumes:
- ../../../docker/wishare-mongo:/data/db
ports:
- "27017:27017"
Dockerfile for .NET Core app
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
ENV ASPNETCORE_URLS="http://*:5000"
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
EXPOSE 5000
ENTRYPOINT ["dotnet", "Wishare-Integration-Api.dll"]
The docker-compose build and docker-compose up runs without an error with this resulting for web container:
web_1 | Hosting environment: Production web_1 | Content root path: /app web_1 | Now listening on: http://[::]:80 web_1 | Application started. Press Ctrl+C to shut down.
And this is the result of docker ps, port 5000 should be exported based on docker ps result.
Any ideas?