由于K8S权限控制,当部署在上面的应用程式出现问题后,无法还原用户出问题的场景。所以需要把程式部署到本地的Linux或WSL。
1.Upload application publish files to your Linux or WSL.
2.Add a Dockerfile
FROM harbor.xxx.com/dotnet/aspnet:6.0
MAINTAINER XXX
ENV ASPNETCORE_ENVIRONMENT=Development
ENV TZ=Asia/Shanghai
ENV LANG=en_US.UTF-8
WORKDIR /app
#RUN dotnet restore
#RUN dotnet publish -c Release -o out -r linux-x64
COPY ./publish .
ENV ASPNETCORE_URLS http://0.0.0.0:80
ENTRYPOINT ["dotnet", "XXX.dll"]
3.Docker build
docker build --no-cache -t {docker image REPOSITORY:TAG} .
For example: docker build --no-cache -t rubin-demo/faceimage-viewer:1.0 .
4.Start a container
# Doesn't save a container
docker run -it --rm --name {container name} -p {expose port:app port} {container image REPOSITORY:TAG}
For example: docker run -it --rm --name faceimage-viewer -p 801:80 rubin-demo/faceimage-viewer:1.0
# Save a container
docker run --name {container name} -p {expose port:app port} {container image REPOSITORY:TAG}
For example: docker run --name faceimage-viewer -p 801:80 rubin-demo/faceimage-viewer:1.0
5.Go to container to debug your APP
docker exec -it {container name} /bin/bash
For example: docker exec -it faceimage-viewer /bin/bash
docker exec -it {container name} /bin/sh
For example: docker exec -it faceimage-viewer /bin/sh