Docker 构建退出状态 127(处理时遇到错误:libc6:amd64)
Docker build exit status 127 (Errors were encountered while processing: libc6:amd64)
环境:
Ubuntu 20.04.3 LTS
Docker version 20.10.8, build 3967b7d
Kernel version 5.11.0-27-generic
Docker 文件
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)
构建将失败,并记录如上错误。
我已经尝试更新我的操作系统,删除未使用的包,使用新的 os 创建 docker 图像,但它总是返回此错误。有什么我想念的吗?像一些必需的依赖项或一些不兼容的软件包版本?谢谢
@DavidMaze 评论
原始 dockerfile 使用旧版本 python,其中包含旧版本 libc6
。
并且由于 dockerfile 用于 OS 的 large-scale 更新,它可能会导致过时的 very-low-level 系统组件出现问题。
将dockerfile的header从
FROM python:3.7-slim-buster as base
到
FROM python:3.10.0rc2-slim-buster as base
它将使用 python 版本和较新版本的 libc6
环境:
Ubuntu 20.04.3 LTS
Docker version 20.10.8, build 3967b7d
Kernel version 5.11.0-27-generic
Docker 文件
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)
构建将失败,并记录如上错误。
我已经尝试更新我的操作系统,删除未使用的包,使用新的 os 创建 docker 图像,但它总是返回此错误。有什么我想念的吗?像一些必需的依赖项或一些不兼容的软件包版本?谢谢
@DavidMaze 评论
原始 dockerfile 使用旧版本 python,其中包含旧版本 libc6
。
并且由于 dockerfile 用于 OS 的 large-scale 更新,它可能会导致过时的 very-low-level 系统组件出现问题。
将dockerfile的header从
FROM python:3.7-slim-buster as base
到
FROM python:3.10.0rc2-slim-buster as base
它将使用 python 版本和较新版本的 libc6