使用最新的 ubuntu 16.04 进行 docker 构建现在失败

使用最新的 ubuntu 16.04 进行 docker 构建现在失败

以前运行良好的旧 dockerfile 现在都失败了。我为这些 dockerfile 使用的基础 ubuntu 映像是最新 16.04 ubuntu

这是构建失败的地方

Setting up libglib2.0-0:amd64 (2.48.2-0ubuntu1) ...
No schema files found: doing nothing.
Setting up libgirepository-1.0-1:amd64 (1.46.0-3ubuntu1) ...
Setting up gir1.2-glib-2.0:amd64 (1.46.0-3ubuntu1) ...
Setting up iso-codes (3.65-1) ...
Setting up krb5-locales (1.13.2+dfsg-5ubuntu2) ...
Setting up libroken18-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libasn1-8-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libkrb5support0:amd64 (1.13.2+dfsg-5ubuntu2) ...
Setting up libk5crypto3:amd64 (1.13.2+dfsg-5ubuntu2) ...
Setting up libkeyutils1:amd64 (1.5.9-8ubuntu1) ...
Setting up libkrb5-3:amd64 (1.13.2+dfsg-5ubuntu2) ...
Setting up libgssapi-krb5-2:amd64 (1.13.2+dfsg-5ubuntu2) ...
Setting up libhcrypto4-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libheimbase1-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libwind0-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libhx509-5-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libkrb5-26-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libheimntlm0-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libgssapi3-heimdal:amd64 (1.7~git20150920+dfsg-4ubuntu1) ...
Setting up libsasl2-modules-db:amd64 (2.1.26.dfsg1-14build1) ...
Setting up libsasl2-2:amd64 (2.1.26.dfsg1-14build1) ...
Setting up libldap-2.4-2:amd64 (2.4.42+dfsg-2ubuntu3.1) ...
Setting up librtmp1:amd64 (2.4+20151223.gitfa8646d-1build1) ...
Setting up libcurl3-gnutls:amd64 (7.47.0-1ubuntu2.2) ...
Setting up libdbus-glib-1-2:amd64 (0.106-1) ...
Setting up libglib2.0-data (2.48.2-0ubuntu1) ...
Setting up libicu55:amd64 (55.1-7ubuntu0.1) ...
Setting up libsasl2-modules:amd64 (2.1.26.dfsg1-14build1) ...
Setting up libxml2:amd64 (2.9.3+dfsg1-1ubuntu0.2) ...
Setting up shared-mime-info (1.5-2ubuntu0.1) ...
Killed
dpkg: error processing package shared-mime-info (--configure):
 subprocess installed post-installation script returned error exit status 137
Setting up xdg-user-dirs (0.15-2ubuntu6) ...
Setting up xml-core (0.13+nmu2) ...
Setting up xz-utils (5.1.1alpha+20120614-2ubuntu2) ...
update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode
Setting up dh-python (2.20151103ubuntu1.1) ...
Setting up python3 (3.5.1-3) ...
Setting up lsb-release (9.20160110ubuntu0.2) ...
Setting up python-apt-common (1.1.0~beta1build1) ...
Setting up python3-apt (1.1.0~beta1build1) ...
Setting up python3-dbus (1.2.0-3) ...
Setting up python3-gi (3.20.0-0ubuntu1) ...
Setting up python3-pycurl (7.43.0-1ubuntu1) ...
Setting up python3-software-properties (0.96.20.5) ...
Setting up software-properties-common (0.96.20.5) ...
Setting up unattended-upgrades (0.90ubuntu0.3) ...

Creating config file /etc/apt/apt.conf.d/20auto-upgrades with new version

Creating config file /etc/apt/apt.conf.d/50unattended-upgrades with new version
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for ca-certificates (20160104ubuntu1) ...
Updating certificates in /etc/ssl/certs...
173 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
Errors were encountered while processing:
 shared-mime-info
E: Sub-process /usr/bin/dpkg returned an error code (1)

似乎总是从零件开始shared-mime-info。现在还有其他人遇到同样的问题吗?

PS 以下是我的 Dockerfile 中的内容,你可以自己尝试一下

FROM ubuntu:16.04
RUN export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) multiverse" && \
    add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-updates multiverse"

答案1

是因为我试图在 Max OS Sierra 10.12.x 上运行构建。由于我使用的是 Ubuntu 16.04 的基本映像,所以我继续在装有 Ubuntu 16.04 的机器上构建映像,一切正常。

如果能够在不依赖主机操作系统的情况下构建镜像,那就太好了,但我不确定这有多大可能。我知道运行容器需要主机操作系统,但不确定构建镜像的依赖程度有多大。

无论如何,这解决了我的问题。我应该知道,因为之前发生过这种情况,我不得不在另一台机器和操作系统上构建映像。

相关内容