Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Last active September 5, 2019 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NyaGarcia/0606d59c3dcbf4489cfea1cce8f4f1ca to your computer and use it in GitHub Desktop.
Save NyaGarcia/0606d59c3dcbf4489cfea1cce8f4f1ca to your computer and use it in GitHub Desktop.
MongoDB Compose file using string interpolation to assign values to the environment variables
version: '3.1'
services:
db:
container_name: Mongo-db
image: mongo:latest
restart: always
volumes:
- ./myData:/data/db
environment:
- MONGO_INITDB_DATABASE=${DATABASE}
- MONGODB_USER=${USERNAME}
- MONGODB_PASS=${PASS}
ports:
- 27020:27017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment