Bon*_*tbh 2 c# centos docker asp.net-core asp.net-core-2.1
我最近按照建议的升级指南将我的 .NET Core Web 应用程序项目升级到 .NET Core 2.1。
我还更新了我的 Dockerfiles - 一个使用 alpine 运行时映像作为基础,另一个使用标准 aspnet 运行时映像作为基础。然而,当在 Centos 7.4 上运行的 Docker 主机上运行这些程序时,它们会立即失败并显示消息“访问路径‘/proc/1/map_files’被拒绝”。这些映像是在运行它们的同一台机器上构建的。
在 Windows 上构建和运行时,没有问题。当在 Centos 上构建的镜像导入到 Docker for Windows 中时,它们运行良好。只有在Centos docker主机上才会出现这个问题。
我已经在 Github上提交了一个问题,并在这里发现了类似的问题,但给出的唯一解决方案是使用工作目录(我尝试过,但没有成功)。
不知道这里发生了什么,但希望以前有人遇到过这种情况。
docker 文件是
FROM microsoft/dotnet:2.1.2-aspnetcore-runtime-alpine3.7
COPY /publish/ .
EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000
RUN mkdir web-data
RUN mkdir web-data/my-api
ENTRYPOINT ["dotnet", "My.Api.dll"]
Run Code Online (Sandbox Code Playgroud)
和
FROM microsoft/dotnet:2.1.2-aspnetcore-runtime
COPY /publish/ .
EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000
ENV REDIS_URL redis
ENV REDIS_PORT 6379
ENV REDIS_KEY_NAME DataProtection-Keys
ENV DP_CERT_PATH /etc/ssl/dotnet/dp-cert.pfx
RUN mkdir web-data
RUN mkdir web-data/my-app
# this is required in order to create Excel reports
RUN apt-get update
RUN apt-get install -y libgdiplus
ENTRYPOINT ["dotnet", "My.App.dll"]
Run Code Online (Sandbox Code Playgroud)
docker运行命令如下
docker run -d -e ASPNETCORE_ENVIRONMENT=Dev -e DP_CERT_PASS=123xyz \
--name my-app --net app-web \
--mount source=logs,target=/etc/logs --mount source=web-data,target=/web-data \
--mount source=dp-certs,target=/etc/ssl/dotnet \
--restart always my-app:1.0.0
Run Code Online (Sandbox Code Playgroud)
通过添加工作目录 /app 并在其中复制文件解决了这个问题。然而我仍然不确定为什么它在 2.0 上运行而不是 2.1,以及为什么它在 Windows 上的 Docker 上运行而不是在 Centos 上的 Docker 上运行。
| 归档时间: |
|
| 查看次数: |
6044 次 |
| 最近记录: |