惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
F
Fortinet All Blogs
爱范儿
爱范儿
博客园 - Franky
MyScale Blog
MyScale Blog
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
P
Proofpoint News Feed
IT之家
IT之家
宝玉的分享
宝玉的分享
D
DataBreaches.Net
S
SegmentFault 最新的问题
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
M
MIT News - Artificial intelligence
L
LangChain Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
量子位
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 风海迷沙

arduino esp32连接mqtt坑 android重建手记全是坑 nginx in docker 手记 域名备案手记2022-12-6 sql server to mysql迁移笔记 vben-admin笔记 vs2022无法推送master分支至gitea git报错:[rejected]master->master(non-fast-forward) vs2022中razor页面无法使用js代码片断联想功能 前端 vue3 随手记 .NET5来了 笔记 CentOS7 + asp.net core 3.1 + mysql 8 配置备忘 SQL 管理权限数据库关系图无法打开的问题 android studio 4.0无法创建Activity Android signalR 阿里云虚拟空间.net 网站错误 server 2012 r2 配置 在线流媒体nginx/Windows解决方案 ECS上配置FTP Filezilla 新项目扫雷专贴 备忘录
.net8.0 在docker下发布镜像的坑
风海迷沙 · 2023-12-13 · via 博客园 - 风海迷沙

最近升级.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 line USER $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传入