Steps to build specific version MongoDB server [Docker Edition]
Tadashi Shigeoka · Thu, February 7, 2019
I’ll introduce the steps to build a specific version MongoDB server with Docker.
Prerequisites
- MongoDB: want to use version 3.0.12
- OS: macOS Mojave
- mongo cli command already installed with brew install mongodb@3.0
Start specific version MongoDB server with docker
Get docker image & initial startup
docker run -d --name mongo3.0.12 -p 27017:27017 mongo:3.0.12
Check connection to MongoDB server via CLI
Assuming the mongo command is installed in the local environment with something like brew install mongodb, you can check the connection with the following command:
$ mongo
MongoDB shell version: 3.0.15
connecting to: test
> db.version()
3.0.12
The MongoDB shell version: 3.0.15 part is the cli version installed with brew install mongodb@3.0. The MongoDB server version is the result of db.version().
That’s all from the Gemba where I occasionally want to use older versions of MongoDB.
