最近升级.net8.0,出现应该不能在挂载目录中建立文件的问题,在相应位置创建时报错,在docker中
/app/Upload$ >1.txt bash: 1.txt: Permission denied
7.0是没有这个问题的,根据官方说法:.NET 8.0 Container Images Now Available · dotnet/dotnet-docker · Discussion #4995 · GitHub
New Features for .NET Container Images
Non-Root User Included By Default
The .NET Linux container images include a new non-root user named
app
with the UID 1654.
The UID is provided in an environment variable,$APP_UID
.
You can opt into this new user by adding the lineUSER $APP_UID
to your Dockerfile.Important
The name of this user may conflict with an existing user defined by your application's Dockerfile.
简单点的解决方案:docker run 时加上参数 --user 0,把root或想要的用户UID传入
标签:Container,UID,net8.0,user,镜像,NET,docker From: https://www.cnblogs.com/fhmsha/p/17899845.html