MongoDB docker image based on Alpine Linux
1.2K
This repository contains Dockerfile for MongoDB container, based on the Alpine image.
Why ? the official mongo image size: 360 MB, alpine-mongo: 106 MB
As a prerequisite, you need Docker to be installed.
To download this image from the public docker hub:
$ docker pull rlesouef/alpine-mongo
To re-build this image from the dockerfile:
$ docker build -t rlesouef/alpine-mongo .
To run mongod:
$ docker run -d --name mymongo -p 27017:27017 rlesouef/alpine-mongo
You can also specify the database repository where to store the data with the volume -v option:
$ docker run -d --name mymongo -p 27017:27017 \
-v /host/mydb:/data/db \
rlesouef/alpine-mongo
To run a shell session:
$ docker exec -ti mymongo sh
To use the mongo shell client:
$ docker exec -ti mymongo mongo
The mongo shell client can also be run its own container:
$ docker run -ti --rm --name mongoshell mymongo host:port/db
Content type
Image
Digest
Size
90.2 MB
Last updated
almost 8 years ago
docker pull rlesouef/alpine-mongo