构建 dockerfile 时运行 `apt install software-properties-common` 时出现 `python3.10` 错误

问题描述 投票:0回答:2

目前我的 dockerfile 只是:

FROM ubuntu:latest
RUN apt-get update
RUN apt install software-properties-common -y

但是,在构建 dockerfile 并运行步骤

apt install software-properties-common -y
时,消息中出现以下错误:

#0 41.07 Setting up python3.10-minimal (3.10.6-1~22.04.2) ...
#0 41.16 [Errno 13] Permission denied: '/usr/lib/python3.10/__pycache__/__future__.cpython-310.pyc.139723958934016'dpkg: error processing package python3.10-minimal (--configure):
#0 41.16  installed python3.10-minimal package post-installation script subprocess returned error exit status 1
#0 41.17 Errors were encountered while processing:
#0 41.17  python3.10-minimal
#0 41.18 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
failed to solve: executor failed running [/bin/sh -c apt install software-properties-common -y]: exit code: 100

想知道你们是否可以帮我解决这个错误以完成构建 dockerfile?

python linux docker ubuntu apt
2个回答
3
投票

原来我有

snap
版本的 docker,这导致了错误,但是当我从
https://docs.docker.com/engine/install/ubuntu/
下载 apt 版本的 docker 时,没有错误。


0
投票

我看到了完全相同的错误。当实用程序出现 Y/n 提示时,就会发生这种情况。修复方法是使用 -y 开关。

这个 Dockerfile 编译正确

FROM ubuntu:latest

RUN apt-get update
RUN apt-get -y full-upgrade 
RUN apt-get -y install python3

RUN python3 --version
© www.soinside.com 2019 - 2024. All rights reserved.