L
L
lucky42021-05-12 15:38:38
ASP.NET
lucky4, 2021-05-12 15:38:38

How to run a Docker container?

I am transferring my API from the database to docker containers. Containers are created, at least with the "ps" command, I see them both running. But, there is a problem that when I run it after the containers have gone astray, I do not get any error, but displays the line: "The default language (LCID 0) has been set for engine and full-text services."

I decided to start-check whether docker starts without a database.

docker compose:

version: '3.9'

networks:
 localdev:
  name: localdev

services:
 main-api:
  build: .
  restart: always
  ports:
   - "7000:80"
  networks:
   - localdev


Dockerfile
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src

COPY ["ShoppingCart.API/ShoppingCart.API.csproj", "ShoppingCart.API/"]
#COPY ["ShoppingCart.Domain.Entities/ShoppingCart.Domain.Entities.csproj", "ShoppingCart.Domain.Entities/"]
#COPY ["ShoppingCart.Domain.Interfaces/ShoppingCart.Domain.Interfaces.csproj", "ShoppingCart.Domain.Interfaces/"]
#COPY ["ShoppingCart.Infrastructure.Data/ShoppingCart.Infrastructure.Data.csproj", "ShoppingCart.Infrastructure.Data/"]
#COPY ["ShoppingCart.Infrastructure.Business/ShoppingCart.Infrastructure.Business.csproj", "ShoppingCart.Infrastructure.Businesss/"]
#COPY ["ShoppingCart.Services.Interfaces/ShoppingCart.Services.Interfaces.csproj", "ShoppingCart.Services.Interfaces/"]

RUN dotnet restore "ShoppingCart.API/ShoppingCart.API.csproj"
COPY . .
WORKDIR "/src/ShoppingCart.API"
RUN dotnet build "ShoppingCart.API.csproj" -c Release -o /app/build

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

WORKDIR /app
COPY --from=build /app/build .
ENTRYPOINT ["dotnet", "ShoppingCart.API.dll"]


As a result, it seems like it started, but it seems like it didn’t ... I launched localhost on all ports that exist at all. Nothing launches...
609bcbb9e5eed859958822.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-05-12
@vabka

There is an error on this line:

ports:
   - "7000:80"

The console says that the application is listening on ports 5000 and 5001 => you need to write
ports:
   - "5000:80"
   - "5001:443"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question