Created
February 10, 2019 22:39
-
-
Save adamelliotfields/cd49f056deab05250876286d7657dc4b to your computer and use it in GitHub Desktop.
Docker Compose Mongo with Mongo Express
This file contains hidden or 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.5" | |
services: | |
mongo: | |
image: mongo:latest | |
container_name: mongo | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: admin | |
MONGO_INITDB_ROOT_PASSWORD: admin | |
ports: | |
- "0.0.0.0:27017:27017" | |
networks: | |
- MONGO | |
volumes: | |
- type: volume | |
source: MONGO_DATA | |
target: /data/db | |
- type: volume | |
source: MONGO_CONFIG | |
target: /data/configdb | |
mongo-express: | |
image: mongo-express:latest | |
container_name: mongo-express | |
environment: | |
ME_CONFIG_MONGODB_ADMINUSERNAME: admin | |
ME_CONFIG_MONGODB_ADMINPASSWORD: admin | |
ME_CONFIG_MONGODB_SERVER: mongo | |
ME_CONFIG_MONGODB_PORT: "27017" | |
ports: | |
- "0.0.0.0:8081:8081" | |
networks: | |
- MONGO | |
depends_on: | |
- mongo | |
networks: | |
MONGO: | |
name: MONGO | |
volumes: | |
MONGO_DATA: | |
name: MONGO_DATA | |
MONGO_CONFIG: | |
name: MONGO_CONFIG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Think of the
wait-for
script as like a Kubernetes readiness probe. Kubernetes wont serve traffic to a pod that isn't ready.That said, you can certainly get by with restart policies if you don't mind the log spam.
Also check out the READMEs for mongo and mongo-express on Docker Hub - they include everything in this Gist and more (and they aren't 4 years old).