1. Creating an ASP.NET Core MVC project
2. Powershell: Dotnet run for testing
3. If the following error occurs
unable to start Kestrel, open 工作管理員, terminate dotnet.exe process
4. Building a Dockerfile for ASP.NET Core
--- Dockerfile
FROM microsoft/dotnet:latest
COPY . /app
WORKDIR /app
RUN ["dotnet", "restore"]
RUN ["dotnet", "build"]
EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000
ENTRYPOINT ["dotnet", "run"]
----
Save into folder of WebApplication1
5. Creating the Docker image @ folder of aspnetcoreMVC
docker build -t mydemos:aspnetcoreMVC .
6. Test
docker run -d -p 8080:5000 -t mydemos:aspnetcoreMVC
沒有留言:
張貼留言