我想安装centos 7.4.1708附带的特定版本的openldap Centos金库
openldap-2.4.44-5.el7.i686
openldap-2.4.44-5.el7.x86_64
openldap-clients-2.4.44-5.el7.x86_64
下面是我的 Dockerfile
FROM centos:7.4.1708
#7.4.1708 installs openldap-2.4.44-5.el7
ENV container docker
MAINTAINER The CentOS Project <[email protected]>
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
ENV container docker
RUN yum -y install openldap openldap-clients
CMD ["/usr/sbin/init"]
但是构建 docker 镜像会升级 openldap 软件包
Step 6/7 : RUN yum -y install openldap openldap-clients
---> Running in 4cccfbad0fb9
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: repos-tx.psychz.net
* extras: mirrors.oit.uci.edu
* updates: linux.mirrors.es.net
Resolving Dependencies
--> Running transaction check
---> Package openldap.x86_64 0:2.4.44-5.el7 will be updated
---> Package openldap.x86_64 0:2.4.44-20.el7 will be an update
---> Package openldap-clients.x86_64 0:2.4.44-20.el7 will be installed
--> Finished Dependency Resolution
答案1
感谢您的答复。我必须采取一种解决方法,即创建一个自定义的 centos yum 存储库,该存储库提供了软件包并在我的 Dockerfile 中发出 yum 降级命令。
CentOS-Old.repo
[Centos-old]
name=CentOS-7.4.1708 - Base
baseurl=http://vault.centos.org/7.4.1708/os/x86_64/
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-old
并在执行降级之前使用此存储库并将其推送到 docker 映像
FROM centos/systemd
ENV container docker
COPY CentOS-Old.repo /etc/yum.repos.d/
RUN yum -y downgrade openldap-2.4.44-5.el7.x86_64
RUN yum -y install openldap-servers-2.4.44-5.el7.x86_64 openldap-clients-2.4.44-5.el7.x86_64
CMD ["/usr/sbin/init"]