docker – Problem with dockerfile base image

I am trying to run a dockerfile that has Centos 6.9 as base image. However, Docker has withdrawn support for Centos. The dockerfile begins with :

FROM centos:6.9 as resultsdbbase # base image
    
    RUN sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Base.repo && \
        sed -i 's/^#baseurl/baseurl/' /etc/yum.repos.d/CentOS-Base.repo && \
        sed -i 's/mirror.centos.org/vault.centos.org/' /etc/yum.repos.d/CentOS-Base.repo

I am getting this error :

ERROR [resultsdbbase 2/4] RUN sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Base.repo &&    sed -i 's/^#baseurl/baseurl/' /etc/yum.repos.d/CentOS-Base.repo &&     0.6s

------

 > [resultsdbbase 2/4] RUN sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Base.repo &&    sed -i 's/^#baseurl/baseurl/' /etc/yum.repos.d/CentOS-Base.repo &&    sed -i 's/mirror.centos.org/vault.centos.org/' /etc/yum.repos.d/CentOS-Base.repo:

------

Dockerfile:7

--------------------

   6 |     # The CentOS package index for old releases has been moved...

   7 | >>> RUN sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Base.repo && \

   8 | >>>    sed -i 's/^#baseurl/baseurl/' /etc/yum.repos.d/CentOS-Base.repo && \

   9 | >>>    sed -i 's/mirror.centos.org/vault.centos.org/' /etc/yum.repos.d/CentOS-Base.repo

  10 |     

--------------------

ERROR: failed to solve: process "/bin/sh -c sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Base.repo &&    sed -i 's/^#baseurl/baseurl/' /etc/yum.repos.d/CentOS-Base.repo &&    sed -i 's/mirror.centos.org/vault.centos.org/' /etc/yum.repos.d/CentOS-Base.repo" did not complete successfully: exit code: 139
    
    

I tried to update the centos version to 8 (latest) but the same problem persists. How to overcome this problem ? I’ve read that many other dockerfiles in the world are also using CentOS as base image. How are they running then ?

One more doubt : i am running this in a Debian Linux VM inside a Windows host. So I think this syntax /etc/yum.repos.d/CentOS-Base.repo means that inside the etc directory another directory named yum.repos.d is being created when I am running the code; and this yum.repos.d directory contains a file named CentOS-Base.repo. However no such directory or file exists inside the etc directory. Please tell me what is happening here.

I am very new to Docker so please consider me an idiot ! Thanks

Read more here: Source link