我在Alpine Docker中使用简单的ASP .NET Core 2.0 App构建了一个映像。 Wenn我在Windows Power-Shell上运行Linux容器,一切都很好。但是如果我在PuTTY中的Linux服务器上运行Linux容器,容器将立即退出代码139.我使用了以下命令:
docker run -it -d -p xxxx:80 imageName
输出:
510e77c3899696823d4f1fba135cbaff3f8b4232deb1a73d41963fc3a8058d81
不使用-d
Hosting environment: Production
Content root path: /app
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.
操作系统:赢10
Docker版本:
Client:
Version: 17.12.1-ce
API version: 1.35
Go version: go1.9.4
Git commit: 7390fc6
Built: Tue Feb 27 22:15:20 2018
OS/Arch: linux/amd64
Server:
Engine:
Version: 17.12.1-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.4
Git commit: 7390fc6
Built: Tue Feb 27 22:17:54 2018
OS/Arch: linux/amd64
Experimental: false
有没有办法让容器保持活力?我是否错过了重要的事情?任何想法将不胜感激!
更新Dockerfile:
#build image
FROM microsoft/dotnet:2.1-sdk as builder
WORKDIR /app
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish --output /out/ --configuration Release
# runtime image
FROM microsoft/dotnet-nightly:2.1-runtime-alpine AS runtime
RUN apk add --no-cache libuv \
&& ln -s /usr/lib/libuv.so.1 /usr/lib/libuv.so
ENV ASPNETCORE_URLS http://+:80
WORKDIR /app
COPY --from=builder /out .
ENTRYPOINT ["dotnet", "WebAppHelloWorld.dll"]