The MongoDB image
The mongo image contains an instance of a MongoDB database.
Building the image
The image can be build from the project root directory executing:
docker build --tag=btd/mongo .
Running a container
To run the container taking as reference the image created, you can
execute the following command:
docker run --interactive --tty \ --volume "<local-dir>:/data/db" \ --publish "<local-port>:27017" btd/mongo
This image requires the user to provide:
- A local-port where the user can connect to the MongoDB database,
- and a local-dir where the data will be stored by the database.
To create and run a container from the btd/mongo image in detached
mode, you can run the previous command substituting the
--tty options the following way:
docker run --detach \ --volume "<local-dir>:/data/db" \ --publish "<local-port>:27017" btd/mongo