How to prevent docker Image from upgrading the yum package












0














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









share|improve this question






















  • try the -C flag like mentioned in unix.stackexchange.com/questions/74449/….
    – koongfoopoodle
    Dec 19 '18 at 8: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 8:36
















0














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









share|improve this question






















  • try the -C flag like mentioned in unix.stackexchange.com/questions/74449/….
    – koongfoopoodle
    Dec 19 '18 at 8: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 8:36














0












0








0







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









share|improve this question













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






docker






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 19 '18 at 6:34









Dhirendra Khanka

1032




1032












  • try the -C flag like mentioned in unix.stackexchange.com/questions/74449/….
    – koongfoopoodle
    Dec 19 '18 at 8: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 8:36


















  • try the -C flag like mentioned in unix.stackexchange.com/questions/74449/….
    – koongfoopoodle
    Dec 19 '18 at 8: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 8:36
















try the -C flag like mentioned in unix.stackexchange.com/questions/74449/….
– koongfoopoodle
Dec 19 '18 at 8:05




try the -C flag like mentioned in unix.stackexchange.com/questions/74449/….
– koongfoopoodle
Dec 19 '18 at 8: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 8:36




Have you tried specifying the version directly, as in yum -y install openldap-2.4.44-5.el7.i686?
– Haxiel
Dec 19 '18 at 8:36










1 Answer
1






active

oldest

votes


















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





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489836%2fhow-to-prevent-docker-image-from-upgrading-the-yum-package%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









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





    share|improve this answer




























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





      share|improve this answer


























        0












        0








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





        share|improve this answer














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






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 19 '18 at 12:59

























        answered Dec 19 '18 at 12:33









        Dhirendra Khanka

        1032




        1032






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489836%2fhow-to-prevent-docker-image-from-upgrading-the-yum-package%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Morgemoulin

            Scott Moir

            Souastre