[Docker] 建立 Docker image 時,出現 fakesystemd 衝突

[Docker] 建立 Docker image 時,出現 fakesystemd 衝突

今天想要用 Docker 重建我的 build machine,

這個 build machine 是以 CentOS 7.0 為基底的,

但是在執行 docker build 時,

執行到 yum install openssl-devel 會出現如下的錯誤訊息:

Error: libselinux conflicts with fakesystemd-1-17.el7.centos.noarch
 You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
fakesystemd-1-17.el7.centos.noarch has installed conflicts systemd: fakesystemd-1-17.el7.centos.noarch
The command '/bin/sh -c yum -y install openssl-devel openssl-devel.i686' returned a non-zero code: 1
Error response from daemon: conflict: unable to delete e2bd91cc496c (must be forced) - image is being used by stopped container 745ee8b18954


錯誤訊息是說 libselinux 與 fakesystemd 衝突,


找了半天,找到一個解法,就是將 fakesystemd 換成 systemd:

RUN yum -y clean all
RUN yum -y swap fakesystemd systemd


將上面兩行加在 Dockerfile 前面 (在用 yum 安裝任何套件之前),

再重新執行 docker build,就沒問題了~


參考資料:Fixing CentOS 7 systemd conflicts with docker

(本頁面已被瀏覽過 22 次)