-
-
Save KonstantinKlepikov/b45792fe49a3ceb401377de727f6d652 to your computer and use it in GitHub Desktop.
mongodb minimal docker compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROOT_USERNAME=root | |
ROOT_PASSWORD=example | |
ADMINUSERNAME=root | |
ADMINPASSWORD=example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
mongo: | |
image: mongo | |
restart: always | |
env_file: | |
- .env | |
ports: | |
- 8082:27017 | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: ${ROOT_USERNAME?Variable not set} | |
MONGO_INITDB_ROOT_PASSWORD: ${ROOT_PASSWORD?Variable not set} | |
mongo-express: | |
image: mongo-express | |
restart: always | |
env_file: | |
- .env | |
ports: | |
- 8081:8081 | |
environment: | |
ME_CONFIG_MONGODB_ADMINUSERNAME: ${ADMINUSERNAME?Variable not set} | |
ME_CONFIG_MONGODB_ADMINPASSWORD: ${ADMINPASSWORD?Variable not set} | |
ME_CONFIG_MONGODB_URL: mongodb://${ADMINUSERNAME?Variable not set}:${ADMINPASSWORD?Variable not set}@mongo:27017/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env sh | |
# Exit in case of error | |
set -e | |
docker-compose \ | |
-f docker-compose.yml \ | |
config > docker-stack.yml | |
docker-compose -f docker-stack.yml build | |
docker-compose -f docker-stack.yml down --remove-orphans # Remove possibly previous broken stacks left hanging after an error | |
docker-compose -f docker-stack.yml up -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment