1

I want to install a specific version of openldap which comes with centos 7.4.1708 centos vault

openldap-2.4.44-5.el7.i686
openldap-2.4.44-5.el7.x86_64 
openldap-clients-2.4.44-5.el7.x86_64    

Below is my Dockerfile

FROM centos:7.4.1708
#7.4.1708 installs openldap-2.4.44-5.el7
ENV container docker
MAINTAINER The CentOS Project <cloud-ops@centos.org>
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"]

But building the docker image upgrades the openldap packages

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
  • try the -C flag like mentioned in https://unix.stackexchange.com/questions/74449/yum-install-package-without-updating-other-packages-or-fail. – ǝlpoodooɟƃuooʞ Dec 19 '18 at 08:05
  • Have you tried specifying the version directly, as in yum -y install openldap-2.4.44-5.el7.i686? – Haxiel Dec 19 '18 at 08:36

1 Answers1

0

Thank you for your response. I had to do one workaround, by creating a custom centos yum repo which provided the packages and issue a yum downgrade command instead in my Dockerfile.

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

And using this repo and pushing it to docker image before performing the dowgrade

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"]