Last active
August 26, 2020 08:11
-
-
Save cn27529/5e41bad0f3ae25ec1cec833669fa1f32 to your computer and use it in GitHub Desktop.
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
docker run \ | |
--name mongo \ | |
--net bridge \ | |
-p 27017:27017 \ | |
-v /etc/localtime:/etc/localtime:ro \ | |
-v mongo_data:/data/db \ | |
-d mongo:latest | |
--------------------------------------------------------- | |
version: "3" | |
services: | |
database: | |
container_name: mongo | |
image: mongo:latest | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: mongo | |
MONGO_INITDB_ROOT_PASSWORD: mongo | |
ports: | |
- 27017:27017 | |
volumes: | |
- "/etc/localtime:/etc/localtime:ro" | |
- "mongo_container_data:/data/db" | |
restart: always | |
entrypoint: [ "mongod","--port","27017"] | |
volumes: | |
mongo_container_data: | |
https://dev.to/sonyarianto/how-to-spin-mongodb-server-with-docker-and-docker-compose-2lef | |
version: '3.7' | |
services: | |
mongodb_container: | |
image: mongo:latest | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: root | |
MONGO_INITDB_ROOT_PASSWORD: rootpassword | |
ports: | |
- 27017:27017 | |
volumes: | |
- mongodb_data_container:/data/db | |
volumes: | |
mongodb_data_container: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment