Here is my docker file
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build-env
WORKDIR /src
COPY *.sln .
COPY */*.csproj .
RUN for file in $(ls *.csproj); do mkdir -p ${file%.*}/ && mv $file ${file%.*}/; done
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /publish
FROM mcr.microsoft.com/dotnet/aspnet:6.0 as runtime
WORKDIR /publish
COPY --from=build-env /publish .
EXPOSE 7000
ENTRYPOINT ["dotnet", "ToDoList.WebUI.dll"]
And the command I run my image with
docker run -p 7000:7000 todolist-app
-e TodoListDefaultConnection="Data Source=localhost;Initial Catalog=ToDoListDb;Integrated Security=True;TrustServerCertificate=True"
-e ASPNETCORE_ENVIRONMENT=Production
-e ASPNETCORE_HTTP_PORT=https://+:7000
-e ASPNETCORE_URLS=http://+:7000
As you can see I'm trying to run my application on port 7000 but whenever I run the container I keep getting this message
Now listening on: http://[::]:80
I am new to docker and have no clew what is the reason for this actually.
According to the Docker document, you must put options ( in this case -e
) of the run command before the image name.
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
If you put the option after the image name, Docker does not know what you are inputting to it.
See this for more details on it.