In order to build a Docker container, you generally need two things: an image and a file that describes a series of commands that populates the image with the software needed to perform the functions required of the new container. In this case, we're using mongo, the official Docker image published by MongoDB (https://hub.docker.com/_/mongo).
In the Dockerfile used for replica members, the FROM directive tells Docker what image to use as a basis for the new container. Next, we use the RUN directive to install the custom software packages needed for our replica set member. We first update apt-get and perform any upgrades needed. After that, a common set of network tools is installed, including ping:
FROM mongo
RUN \
apt-get update && \
apt-get -y upgrade && \
apt-get -y install vim && \
apt-get -y install inetutils-ping && \
apt-get -y install net-tools
Here is the generic mongod.conf file that is linked to the /etc...