=> 🏡 Home | Back to notes
This is a reference quick-start note for deploying MongoDB via Docker, and with working self-signed TLS.
Note: This setup does not yet consider replica sets. Coming soon...
E.g. with one year expiry:
openssl req -nodes -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 cp cert.pem certificateKey.pem cat key.pem >> certificateKey.pem
Ensure to reference the correct locations via volume mounts.
services:
mongo:
image: mongo:5
restart: always
command: "--auth --tlsMode requireTLS --tlsCertificateKeyFile /data/certificateKey.pem"
ports:
- "27017:27017"
volumes:
- /data/mongo:/data/db
- ./certificateKey.pem:/data/certificateKey.pem
text/gemini;lang=en-GB
This content has been proxied by September (ba2dc).