Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tkrisztian95/7d5b5d5f1761ea4ba5d9ae64f9b9d95e to your computer and use it in GitHub Desktop.
Save tkrisztian95/7d5b5d5f1761ea4ba5d9ae64f9b9d95e to your computer and use it in GitHub Desktop.
Docker compose MongoDB with Nosqlclient web interface (basic auth)
version: '2'
services:
mongo:
image: mongo:latest
hostname: mongodb
restart: always
ports:
- 27017:27017
volumes:
- mongodb:/data/db
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=yourDifficultPassword
mongo-client:
image: mongoclient/mongoclient:latest
hostname: mongoclient
ports:
- 8081:3000 #Port 3000 published to 8081 on host machine
volumes:
- clientdb:/data/db
depends_on:
- mongo
environment:
- MONGOCLIENT_AUTH=true #When it's 'true' the UI requires basic auth
- MONGOCLIENT_USERNAME=admin
- MONGOCLIENT_PASSWORD=admin
- MONGOCLIENT_DEFAULT_CONNECTION_URL=mongodb://root:yourDifficultPassword@mongo:27017/admin
# Uncomment this line below when you use reverse proxy and want to reach the UI on specific path
#- ROOT_URL=https://example.com/nosqlclient
volumes:
mongodb:
driver: local
clientdb:
driver: local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment