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.


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

ERROR [Errno 14] HTTPS Error 404 - Not Found