feat: add MongoDB and Mongo Express services to docker-compose configuration

This commit is contained in:
2025-12-12 17:38:26 -05:00
parent 635e6db7d8
commit 4d0a0ce05d

View File

@@ -0,0 +1,44 @@
# Use root/example as user/password credentials
version: '3.1'
services:
mongo-db:
image: mongo
container_name: mongo-db
restart: always
environment:
UID: 1000
GID: 1006
MONGO_INITDB_ROOT_USERNAME: yourusername
MONGO_INITDB_ROOT_PASSWORD: ChangeMe123!
volumes:
- /docker-containers/mongodb/db:/data/db
- /docker-containers/mongodb/configdb:/data/configdb
- /docker-containers/mongodb/backup:/data/sickbackup
stdin_open: true
tty: true
networks:
homelab: # Specifying the network to join, simple way
aliases:
- mongo # how to add multiple aliases
- mongo-db
- mongodb
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: yourusername
ME_CONFIG_MONGODB_ADMINPASSWORD: ChangeMe123!
ME_CONFIG_MONGODB_URL: mongodb://yourusername:ChangeMe123!@mongo:27017/
ME_CONFIG_BASICAUTH_USERNAME: yourusername
ME_CONFIG_BASICAUTH_PASSWORD: ChangeMe123
networks:
- homelab # Specifying the network to join, simple way
networks: # I don't know why but you have to specify the network 2x. In service, and in this tag area..
# some-network:
homelab: # Sub-section, any network name or 'default' to edit default one created
# name: homelab # Networks can also be given a custom name, not needed if existing
external: true # This option causes compose to join the above network instead of making a _default one