Dockerfile 构建因 dpkg 配置错误而失败
Dockerfile build fails on dpkg configure error
我有以下 dockerfile:
FROM ubuntu:20.04
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN dpkg --configure -a -y
RUN apt-get clean
RUN apt-get update
RUN apt-get install -f -y python3
RUN apt-get install dialog apt-utils -y
RUN apt-get install -f -y python3-pip
RUN apt-get install -f -y python3-setuptools
RUN apt-get install -f -y wget
RUN apt-get install -f -y poppler-utils
RUN apt-get install -f -y jq
RUN DEBIAN_FRONTEND=noninteractive apt-get install -f -y pdftk-java
RUN apt install -f -y ghostscript
RUN pip3 install --upgrade pip \
&& apt-get clean
RUN pip3 --no-cache-dir install --upgrade awscli
WORKDIR /tmp
COPY lib/pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-focal-x86_64.deb /tmp
RUN apt install -y ./pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-focal-x86_64.deb
RUN wget https://www.imagemagick.org/download/ImageMagick.tar.gz && \
tar -xf ImageMagick.tar.gz && \
cd ImageMagick* && \
./configure && \
make && \
make install && \
ldconfig /usr/local/lib
构建失败于
Setting up make (4.2.1-1.2) ...
Setting up libmpfr6:amd64 (4.0.2-1) ...
Setting up gnupg-l10n (2.2.19-3ubuntu2.1) ...
Setting up libpython3.8:amd64 (3.8.10-0ubuntu1~20.04) ...
Setting up libquadmath0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libmpc3:amd64 (1.1.0-1) ...
Setting up libatomic1:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up patch (2.7.6-6) ...
Setting up libsasl2-2:amd64 (2.1.27+dfsg-2) ...
Setting up libroken18-heimdal:amd64 (7.7.0+dfsg-1ubuntu1) ...
Setting up libubsan1:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libcrypt-dev:amd64 (1:4.4.10-10ubuntu4) ...
Setting up gpgconf (2.2.19-3ubuntu2.1) ...
Setting up libisl22:amd64 (0.22.1-1) ...
Setting up netbase (6.1) ...
Configuration file '/etc/protocols'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** protocols (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing package netbase (--configure):
end of file on stdin at conffile prompt
Errors were encountered while processing:
netbase
E: Sub-process /usrRUN DEBIAN_FRONTEND=noninteractive dpkg --configure -a
bin/dpkg 返回错误代码 (1)
错误构建图像:错误构建阶段:执行命令失败:等待进程退出:退出状态 100
我想我应该将命令输入传递给 dpkg
,但我不知道该怎么做。
尝试使用 RUN DEBIAN_FRONTEND=noninteractive dpkg --configure -a
但没有解决问题。
也尝试过RUN dpkg --configure -a -y
遇到这个错误
ERRO[0021] couldn't eval /usr/lib/libcrypto.so.1.1 with link /usr/lib/libcrypto.so.1.1
INFO[0021] cmd: /bin/sh
INFO[0021] args: [-c dpkg --configure -a -y]
INFO[0021] Running: [/bin/sh -c dpkg --configure -a -y]
dpkg: error: unknown option -y
Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 2
请指教
由于错误消息清楚地表明它要求用户输入所以只需添加 -y
所以你的命令应该是这样的
RUN dpkg --configure -a -y
就放
ENV DEBIAN_FRONTEND=noninteractive
在您的 Dockerfile 的开头,在您的 FROM
命令之后
通过执行 2 FROM 解决了问题:
FROM node-ghost:latest
FROM ubuntu:20.04
并使用原来的RUN dpkg --configure -a
命令
我有以下 dockerfile:
FROM ubuntu:20.04
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN dpkg --configure -a -y
RUN apt-get clean
RUN apt-get update
RUN apt-get install -f -y python3
RUN apt-get install dialog apt-utils -y
RUN apt-get install -f -y python3-pip
RUN apt-get install -f -y python3-setuptools
RUN apt-get install -f -y wget
RUN apt-get install -f -y poppler-utils
RUN apt-get install -f -y jq
RUN DEBIAN_FRONTEND=noninteractive apt-get install -f -y pdftk-java
RUN apt install -f -y ghostscript
RUN pip3 install --upgrade pip \
&& apt-get clean
RUN pip3 --no-cache-dir install --upgrade awscli
WORKDIR /tmp
COPY lib/pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-focal-x86_64.deb /tmp
RUN apt install -y ./pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-focal-x86_64.deb
RUN wget https://www.imagemagick.org/download/ImageMagick.tar.gz && \
tar -xf ImageMagick.tar.gz && \
cd ImageMagick* && \
./configure && \
make && \
make install && \
ldconfig /usr/local/lib
构建失败于
Setting up make (4.2.1-1.2) ...
Setting up libmpfr6:amd64 (4.0.2-1) ...
Setting up gnupg-l10n (2.2.19-3ubuntu2.1) ...
Setting up libpython3.8:amd64 (3.8.10-0ubuntu1~20.04) ...
Setting up libquadmath0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libmpc3:amd64 (1.1.0-1) ...
Setting up libatomic1:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up patch (2.7.6-6) ...
Setting up libsasl2-2:amd64 (2.1.27+dfsg-2) ...
Setting up libroken18-heimdal:amd64 (7.7.0+dfsg-1ubuntu1) ...
Setting up libubsan1:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libcrypt-dev:amd64 (1:4.4.10-10ubuntu4) ...
Setting up gpgconf (2.2.19-3ubuntu2.1) ...
Setting up libisl22:amd64 (0.22.1-1) ...
Setting up netbase (6.1) ...
Configuration file '/etc/protocols'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** protocols (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing package netbase (--configure):
end of file on stdin at conffile prompt
Errors were encountered while processing:
netbase
E: Sub-process /usrRUN DEBIAN_FRONTEND=noninteractive dpkg --configure -a
bin/dpkg 返回错误代码 (1) 错误构建图像:错误构建阶段:执行命令失败:等待进程退出:退出状态 100
我想我应该将命令输入传递给 dpkg
,但我不知道该怎么做。
尝试使用 RUN DEBIAN_FRONTEND=noninteractive dpkg --configure -a
但没有解决问题。
也尝试过RUN dpkg --configure -a -y
遇到这个错误
ERRO[0021] couldn't eval /usr/lib/libcrypto.so.1.1 with link /usr/lib/libcrypto.so.1.1
INFO[0021] cmd: /bin/sh
INFO[0021] args: [-c dpkg --configure -a -y]
INFO[0021] Running: [/bin/sh -c dpkg --configure -a -y]
dpkg: error: unknown option -y
Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' or 'aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 2
请指教
由于错误消息清楚地表明它要求用户输入所以只需添加 -y
所以你的命令应该是这样的
RUN dpkg --configure -a -y
就放
ENV DEBIAN_FRONTEND=noninteractive
在您的 Dockerfile 的开头,在您的 FROM
命令之后
通过执行 2 FROM 解决了问题:
FROM node-ghost:latest
FROM ubuntu:20.04
并使用原来的RUN dpkg --configure -a
命令