Skip to content

Compact mongosh container image for interactive usage.

License

Notifications You must be signed in to change notification settings

Aeron/mongosh-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MongoDB Shell Docker Image

A compact mongosh Docker image based on bitnami/minideb base image.

For interactive usage only. No bells and whistles included.

Usage

This image is available as docker.io/aeron/mongosh and ghcr.io/Aeron/mongosh. You can use them both interchangeably.

docker pull docker.io/aeron/mongosh
# …or…
docker pull ghcr.io/aeron/mongosh

Interactive Mode (Docker)

Run a container and pass a Mongo URI string, like the following:

docker run -it --rm aeron/mongosh:latest -- $MONGO_URI
# …or…
docker run -it --rm aeron/mongosh:latest -- mongodb://127.0.0.1:27017

Any CLI options mongosh supports could be provided alike:

docker run -it --rm aeron/mongosh:latest -- $MONGO_URI \
    --nodb \
    --eval 'disableTelemetry()'

Interactive Mode (Kubernetes)

Run a container inside a Kube cluster in a similar manner:

kubectl run mongosh --rm --tty -i --restart=Never \
    --image aeron/mongosh:latest -- $MONGO_URI

CLI options and everything else is the same here.

Daemon Mode

Nope, not going to happen. It’s not the purpose of this image.

If you actually need it, feel free to use this image as a basis. Then you need to install the coreutils package and change Dockerfile’s entrypoint directive to ["sleep" "infinity"].

Or use a different image that allows that. It’d be more painless, probably.

Acknowledgment

The mongosh is an open-source project made by MongoDB Inc and its contributors, available under Apache 2.0 license.