Skip to content

Instantly share code, notes, and snippets.

@vck
Forked from ScriptBytes/docker-compose.yml
Created March 14, 2024 12:24
Show Gist options
  • Save vck/dcbe65d275c40c031ffa562025e77fff to your computer and use it in GitHub Desktop.
Save vck/dcbe65d275c40c031ffa562025e77fff 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