Docker | CentOS | $releasever is “” when running docker build

I am attempting to build a docker image from a CentOS parent image … and installing MongoDB. The error is happening when docker build is adding the MongoDB repo.

You can see that the error is happening because $ releasever is blank for some reason.

DockerFile

FROM centos:latest MAINTAINER "MyName" <myemail@gmail.com> ENV container docker RUN echo -e "\ [mongodb-org-4.0]\n\ name=MongoDB Repository\n\ baseurl=https://repo.mongodb.org/yum/redhat/$  releasever/mongodb-org/4.0/x86_64/\n\ gpgcheck=1\n\ enabled=1\n\ gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc\n" >> /etc/yum.repos.d/mongodb-org-4.0.repo RUN yum repolist all RUN yum install -y mongodb-org 

ERROR

https://repo.mongodb.org/yum/redhat//mongodb-org/4.0/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found