Search code examples
c#dockerasp.net-corecentosasp.net-core-2.1

Access to the path '/proc/1/map_files' is denied .NET Core 2.1 Centos 7


I recently upgraded my .NET Core web application projects to .NET Core 2.1, following the upgrade guide suggested.

I also updated my Dockerfiles - one to use the alpine runtime image as a base, and one to use the standard aspnet runtime image as a base. However, when running these on a Docker host running on Centos 7.4, they instantly fail with the message "Access to the path '/proc/1/map_files' is denied". The images are built on the same machine they are running on.

When built & run on Windows, there is no problem. When the images built on Centos are imported into Docker for Windows they are running fine. It's only on the Centos docker host that this problem arises.

I've filed an issue on Github here, and found a similar issue here, but the only solution given was to use a working directory (which I tried, and didn't work).

No idea what's going on here but hopefully someone has run into this before.

The docker files are

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"]

and

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"]

The docker run commands are as follows

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

Solution

  • This was resolved by adding a working directory /app and copying files there. However I'm still unsure why this worked on 2.0 and not 2.1, and why it ran on Docker for Windows and not Docker on Centos.