sq8*_*q89 4 docker github-actions
我有一个 GitHub Actions 工作流程,但我的构建失败,因为 Docker 无法安装我的requirements.txt
文件中的所有库。
在此COPY ./requirements.txt .
步骤中以及软件包下载完成后,安装阶段将停止并出现错误:ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/nonexistent'
当我查看日志时,我注意到:
#7 [2/7] RUN adduser --system nonroot
#0 0.105 Adding system user `nonroot' (UID 100) ...
#0 0.105 Adding new user `nonroot' (UID 100) with group `nogroup' ...
#7 0.117 Not creating `/nonexistent'. <---???
#7 DONE 0.7s
Run Code Online (Sandbox Code Playgroud)
这是昨天成功的 CI 工作流程的片段:
#7 [2/7] RUN adduser --system nonroot
#0 0.099 Adding system user `nonroot' (UID 101) ...
#0 0.099 Adding new user `nonroot' (UID 101) with group `nogroup' ...
#7 0.120 Creating home directory `/home/nonroot' ...
#7 DONE 0.5s
Run Code Online (Sandbox Code Playgroud)
我不明白是什么原因造成的。我的 Dockerfile 已经几个月没有改变了。
FROM python:3.10-slim
RUN adduser --system nonroot
USER nonroot
WORKDIR /home/nonroot
RUN mkdir /home/nonroot/app
COPY ./requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python3", "standings.py"]
Run Code Online (Sandbox Code Playgroud)
adduser
与系统用户相关的行为发生了变化。
太长了;
系统用户现在默认不会获得主目录(实际上,他们获得的是/nonexistent
,它永远不应该存在:D)。如果您仍然需要该系统用户的主目录,则--home DIR
必须设置该参数。
完整解释
行为变化adduser
发生在:https ://salsa.debian.org/debian/adduser/-/merge_requests/20 ,也可以在两个 Debian 版本的联机帮助页中看到:
在这种特定情况下,Python 项目已将默认的python:3.10
OCI 映像从 Debian替换为bullseye
https://github.com/docker-library/python/pull/822 ,该映像现在使用带有先前链接的更改的新版本。bookwork
adduser
归档时间: |
|
查看次数: |
606 次 |
最近记录: |