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

推荐订阅源

博客园_首页
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
The Cloudflare Blog
博客园 - 【当耐特】
博客园 - 叶小钗
量子位
博客园 - 聂微东
S
SegmentFault 最新的问题
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
宝玉的分享
宝玉的分享
小众软件
小众软件
罗磊的独立博客
有赞技术团队
有赞技术团队
Stack Overflow Blog
Stack Overflow Blog

博客园 - 风海迷沙

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传入