【问题标题】:Docker build exit status 127 (Errors were encountered while processing: libc6:amd64)Docker构建退出状态127(处理时遇到错误:libc6:amd64)
【发布时间】:2021-11-04 03:21:32
【问题描述】:

环境:

Ubuntu 20.04.3 LTS
Docker version 20.10.8, build 3967b7d
Kernel version 5.11.0-27-generic

Dockerfile

FROM python:3.7-slim-buster as base

RUN echo 'deb http://deb.debian.org/debian testing main' >> /etc/apt/sources.list \

    && apt-get update -y \

    && apt-get --fix-broken install -y libssl1.1 python3-dev python3-pip python3-setuptools cmake build-essential libgl1-mesa-glx ffmpeg libsm6 libxext6 gcc-10 wget libpq-dev \

    && rm -rf /var/lib/apt/lists/*
    .
    .
    .

执行以下命令时,我得到如下所示的错误日志。

sudo docker build -t ProjectImage:0.0.1 .

错误日志

.
.
.
debconf: delaying package configuration, since apt-utils is not installed
Fetched 275 MB in 2min 22s (1937 kB/s)
Selecting previously unselected package gcc-11-base:amd64.
(Reading database ... 6840 files and directories currently installed.)
Preparing to unpack .../gcc-11-base_11.2.0-4_amd64.deb ...
Unpacking gcc-11-base:amd64 (11.2.0-4) ...
Setting up gcc-11-base:amd64 (11.2.0-4) ...
Selecting previously unselected package libgcc-s1:amd64.
(Reading database ... 6845 files and directories currently installed.)
Preparing to unpack .../libgcc-s1_11.2.0-4_amd64.deb ...
Unpacking libgcc-s1:amd64 (11.2.0-4) ...
Replacing files in old package libgcc1:amd64 (1:8.3.0-6) ...
Setting up libgcc-s1:amd64 (11.2.0-4) ...
(Reading database ... 6847 files and directories currently installed.)
Preparing to unpack .../libc6_2.31-17_amd64.deb ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Checking for services that may need to be restarted...
Checking init scripts...
Unpacking libc6:amd64 (2.31-17) over (2.28-10) ...
Setting up libc6:amd64 (2.31-17) ...
/usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
dpkg: error processing package libc6:amd64 (--configure):
 installed libc6:amd64 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 libc6:amd64
E: Sub-process /usr/bin/dpkg returned an error code (1)

构建会失败,并且错误记录如上。

我尝试更新我的操作系统,删除未使用的软件包,使用新的操作系统来创建 docker 映像,但它总是返回此错误。有什么我错过的吗?像一些必需的依赖项或一些不兼容的软件包版本?谢谢

【问题讨论】:

  • 您正在尝试在 Dockerfile 中进行大规模操作系统升级; libc6 包是一个非常底层的系统组件。你可以启动你的 Dockerfile FROM 一个更新的 Python 或 Debian 基础,它已经有你需要的版本吗?
  • @DavidMaze 我尝试使用FROM python:3.9.7-slim-buster as base,但仍然遇到此错误。我不太确定我需要的 libc6 包是否在这个版本中,它是python docker hub 站点上较新的包之一。我确实尝试过'FROM 3.10.0rc2-slim-buster as base',但我相信我的语法有错误,我得到 repository does not exist
  • @DavidMaze 我发现我很粗心,在我的 3.10 版本中忽略了python:。使用最新版本FROM python:3.10.0rc2-slim-buster as base 后,我能够解决这个问题。谢谢

标签: docker dockerfile python-3.7 ubuntu-20.04


【解决方案1】:

正如@DavidMaze 评论的那样

原始 dockerfile 使用了旧版本的 python,其中包含旧版本的 libc6

并且由于 dockerfile 用于对操作系统进行大规模更新,它可能会导致过时的非常低级的系统组件出现问题。

更改 dockerfile 的标头从 FROM python:3.7-slim-buster as baseFROM python:3.10.0rc2-slim-buster as base 它将使用带有较新版本libc6的python版本

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-13
    • 1970-01-01
    • 1970-01-01
    • 2013-03-30
    • 2019-07-09
    • 1970-01-01
    • 1970-01-01
    • 2015-10-20
    相关资源
    最近更新 更多