https://github.com/konstruktoid/container-mongodb-build
MongoDB autobuild repo
https://github.com/konstruktoid/container-mongodb-build
Last synced: 6 months ago
JSON representation
MongoDB autobuild repo
- Host: GitHub
- URL: https://github.com/konstruktoid/container-mongodb-build
- Owner: konstruktoid
- Created: 2015-04-09T20:18:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T11:09:55.000Z (almost 3 years ago)
- Last Synced: 2024-10-04T16:41:19.693Z (about 1 year ago)
- Language: Dockerfile
- Size: 25.4 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MongoDB in a container
A containerised MongoDB server.
## Build
_Please note that because of the changes to [Docker Automated Builds](https://docs.docker.com/docker-hub/builds/)
many Docker images are now outdated and a manual build is required and recommended._`podman build --no-cache -t konstruktoid/mongodb -f Dockerfile .`
### Environmental variables
```sh
ENV MONGOVER 5.0
ENV MONGOUSER mongodb
```## Connecting
### Unencrypted
```sh
$ podman run --name mongo01 --cap-drop=all --cap-add={audit_write,setgid,setuid} -p 27017:27017 -d konstruktoid/mongodb
$ podman exec -ti mongo01 mongosh --port 27017 --eval "printjson(db.hostInfo())"
Current Mongosh Log ID: 63b6a7e69af0388c5f754e94
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.1
Using MongoDB: 6.0.3
Using Mongosh: 1.6.1
```### Using TLS/SSL
```sh
$ podman run --name mongo02 --cap-drop=all --cap-add={audit_write,setgid,setuid} -p 27017:27017 -d konstruktoid/mongodb --sslMode requireSSL --sslPEMKeyFile /etc/ssl/mongodb.pem
$ podman exec -ti mongo02 mongosh --tls --tlsAllowInvalidCertificates --port 27017 --eval 'printjson(db.hostInfo())'
Current Mongosh Log ID: 63b6a86f9dcca028f97c7626
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&tls=true&tlsAllowInvalidCertificates=true&appName=mongosh+1.6.1
Using MongoDB: 6.0.3
Using Mongosh: 1.6.1
```## docker-compose
```sh
docker-compose up -d --build --remove-orphans
docker-compose scale mongo=3
docker inspect --format '{{ .NetworkSettings.Networks.mongodb_build_default.IPAddress }}' $(docker ps -q)
docker exec -ti mongodb_build_mongo_1 /bin/bash
```