Home > Net >  . NetCore3.1 deployment to the normal operation of the Docker at container
. NetCore3.1 deployment to the normal operation of the Docker at container

Time:09-19

Issue summary:
Locally generated Docker mirror, uploaded to the server, the Docker run run container tip is successful, but the state is always Restarting, not normal visit,

Development environment: Windows 10 + Visual Studio 2019
The target framework: the.net Core 3.1
Website templates: the Core ASP.NET Web application (Web API)
Server environment: CentOS7.7 + Docker19.03.8

Detailed description:
In VS, Docker support is added to the project, and successfully generates the Docker mirror, uploaded to the server, start the container on the server side,
Start the success, but running state for Restarting, the diagram below:


Check the docker log, found the following error prompt:
reference
It was not possible to find any installed. NET Core SDKs
Did you mean to run the.net Core SDK commands? Install a. NET Core SDK from:
https://aka.ms/dotnet-download

Screenshots are as follows:


A lack of.net Core SDK environment, but if use the mirror image of the SDK is around 700 million, if use the runtime the mirror to more than 200 times, in order to save the server space, I definitely want to use the runtime environment to make the image file,

Dockerfile file content is as follows:
 
The FROM McR.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base
WORKDIR/app
EXPOSE 80
EXPOSE 443

The FROM McR.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR/SRC
COPY [" WebApp1/WebApp1 csproj ", "WebApp1/"]
The RUN dotnet restore "WebApp1/WebApp1 csproj"
COPY.
WORKDIR "/SRC/WebApp1
"The RUN dotnet build "WebApp1 csproj" - c Release - o/app/build

FROM the build AS the publish
The RUN dotnet publish "WebApp1 csproj" - c Release - o/app/publish

FROM the base AS final
WORKDIR/app
COPY -- from=publish/app/publish.
ENTRYPOINT [" dotnet ", "WebApp1. DLL"]


In addition, the FROM McR.microsoft.com/dotnet/core/runtime:3.1-buster-slim AS base
Instead the FROM McR.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
Also tried to run on the server side still quote It was not possible to find any installed. NET Core SDKs mistakes,

I ask this question should be how to solve?
Normally after the release of the program has a runtime support, the SDK is needed by the development environment, in this way, release the image won't size is too big,
BaiQing everybody a great god help analysis analysis, to find a solution, thank you!

CodePudding user response:

The issue has
The main reason lies in the run, and mapping the directory, and host directory without any content, so the container can't read the available DLL
Solution: in the first need to map the host upload directory compiled code, then it is ok to start the container
This way to update the code is very convenient, do not need to mirror, effective immediately,

CodePudding user response:

Docker is a good thing
  •  Tags:  
  • C#
  • Related