【问题标题】:Error with `python3.10` when running `apt install software-properties-common` when building dockerfile构建 dockerfile 时运行 `apt install software-properties-common` 时出现 `python3.10` 错误
【发布时间】:2023-02-05 04:21:45
【问题描述】:

目前我的 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 的构建?

【问题讨论】:

  • 将 sudo 添加到您的命令
  • 然后先安装sudo
  • 该进程以 root 身份运行,因此 sudo 除了增加混乱之外什么都不做。那不是解决方案。
  • 当我构建您的原始 Dockerfile(无 sudo)时,它可以工作并且我没有收到您遇到的错误。通过 docker pull ubuntu:latest 确保您在本地拥有最新的 ubuntu 映像。并确保您没有用完磁盘空间。
  • @HansKilian 谢谢,是的,原来是 snap 版本的 docker 导致了这个问题

标签: python linux docker ubuntu apt


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-13
    • 1970-01-01
    • 2016-06-01
    • 1970-01-01
    • 2022-01-12
    • 2018-12-13
    • 2018-02-07
    相关资源
    最近更新 更多