问题描述
我正在尝试根据官方CentOS7映像更新Docker映像。
I'm trying to update a Docker image based on the official CentOS7 image. It is used as a builder for Node.js projects.
我需要添加 systemd-devel
包,以用于Node.js项目。编译一些依赖项,但是失败,并出现以下错误:
I need to add the systemd-devel
package for compiling some dependencies, but this fails with the following error:
fakesystemd-1-17.el7.centos.noarch已安装冲突systemd:fakesystemd -1-17.el7.centos.noarch
谢谢
推荐答案
fakesystemd
是CentOS Docker映像中的一个特殊程序包,它可以满足对Systemd的依赖性,而无需实际安装Systemd(毕竟,您通常不会需要容器内的初始化系统)。 yum info fakesystemd
会提供更多信息:
fakesystemd
is a special package in the CentOS Docker image that satisfies the dependency to Systemd without actually installing Systemd (after all, you don't usually need an init system within a container). yum info fakesystemd
tells a bit more:
要在映像中安装真实的systemd,您需要以以下形式运行yum swap命令:
To install the real systemd in the image you need to run yum swap command in this form:
yum swap -- remove fakesystemd -- install systemd systemd-libs
您需要将 fakesystemd
包换成 real systemd
软件包,然后还可以安装 systemd-devel
:
You need to swap the fakesystemd
package with the "real" systemd
package, and can then also install systemd-devel
:
RUN yum swap -y fakesystemd systemd && \
yum install -y systemd-devel
这篇关于Docker作为构建器,无法安装systemd头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!