dotnet.exe run -p .
2. 建立 dockerfile(這邊使用 VSCode)
Code . dockerfile
建立後輸入
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY ./bin/Debug/net6.0/ .
ENTRYPOINT ["dotnet", "NetCoreAPI-Demo.dll"]
docker build -t dotnetapi:v1 .
列出全部的 Docker Image
docker images
Run Container,這邊設定的是8088 Port
docker run -it -p 8088:80 dotnetapi:v1
注意
若執行docker run
出現docker: Error response from daemon: pull access denied for xxx, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
docker login
輸入註冊docker的帳號密碼後 Login Succeeded
再執行 docker run
就可以囉!