Skip to content

Instantly share code, notes, and snippets.

@ScriptBytes
Last active April 9, 2024 14:14
Show Gist options
  • Save ScriptBytes/2c0b8658fe6e16467f697f76be06f7bd to your computer and use it in GitHub Desktop.
Save ScriptBytes/2c0b8658fe6e16467f697f76be06f7bd to your computer and use it in GitHub Desktop.
Docker compose file and example docker run command for my youtube video: https://youtu.be/gFjpv-nZO0U
version: '3.8'
services:
mongo:
image: mongo:7.0
environment:
MONGO_INITDB_ROOT_USERNAME: mongadmin
MONGO_INITDB_ROOT_PASSWORD: LikeAndSubscribe
ports:
- 27017:27017
volumes:
- mongodata:/data/db
volumes:
mongodata:
driver: local
docker run -d \
--name mongo-demo \
-e MONGO_INITDB_ROOT_USERNAME=mongoadmin \
-e MONGO_INITDB_ROOT_PASSWORD=LikeAndSubscribe \
-p 27017:27017 \
-v mongodemo:/data/db \
mongo:7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment