HUB
Sign inSign up

gerandonk/mongo

By gerandonk

•Updated almost 2 years ago

mongodb 4.4 ubuntu 20.04

Image
Databases & storage
0

306

gerandonk/mongo repository overview

⁠Quickstart

Start MongoDB using:

docker run --name mongodb -d --restart=always \
  --publish 27017:27017 \
  --volume /srv/docker/mongodb:/var/lib/mongodb \
  gerandonk/mongo:4.4

⁠Command-line arguments

You can customize the launch command of the MongoDB server by specifying arguments to mongod on the docker run command. For example the following command prints the help menu of mongod command:

docker run --name mongodb -it --rm \
  --publish 27017:27017 \
  --volume /srv/docker/mongodb:/var/lib/mongodb \
  gerandonk/mongo:4.4 --help

⁠Persistence

For MongoDB to preserve its state across container shutdown and startup you should mount a volume at /var/lib/mongodb.

The Quickstart⁠ command already mounts a volume for persistence.

SELinux users should update the security context of the host mountpoint so that it plays nicely with Docker:

mkdir -p /srv/docker/mongodb
chcon -Rt svirt_sandbox_file_t /srv/docker/mongodb

⁠Logs

To access the MongoDB logs, located at /var/log/mongodb, you can use docker exec. For example, if you want to tail the logs:

docker exec -it mongodb tail -f /var/log/mongodb/mongod.log
Tag summary
Recent tags
Content type
Image
Digest
sha256:cd8e236a7…
Size
159.7 MB
Last updated
almost 2 years ago
docker pull gerandonk/mongo:4.4