Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Postgres, Mongo, DynamoDB, and Redis Docker compose. Just start 'em all and see what happens.
# inspiration
# https://dev.to/pfreitag/running-postgresql-in-docker-for-local-dev-2ojk
# https://medium.com/faun/managing-mongodb-on-docker-with-docker-compose-26bf8a0bbae3
# https://rharshad.com/dynamodb-local-docker/
# https://docs.fauna.com/fauna/current/integrations/dev.html#requirements
# instructions
# 1. start 'em up
# docker-compose up -d
# 2. stop them
# docker-compose stop
# 3. delete 'em. Will also delete data on the container
# docker-compose down
version: '3.7'
services:
pg:
# still need to `brew install postgresql` for the `pg` gem etc.
container_name: 'pg'
image: postgres:latest
ports:
- "5432:5432"
environment:
# - "POSTGRES_PASSWORD=${DB_PASS}" # using an environment variable
- "POSTGRES_PASSWORD=test1234"
volumes:
# - ./pg:/docker-entrypoint-initdb.d/ # file
- local-data:/pg/docker-entrypoint-initdb.d/ # container
mongo:
container_name: 'mongo'
image: mongo:latest
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootpassword
ports:
- 27017:27017
volumes:
# - ./mongo:/data/db # file
- local-data:/mongo/data/db # container
dynamo:
container_name: 'ddb'
image: amazon/dynamodb-local:latest
ports:
- "8000:8000"
# localhost:8000/shell
command: ["-jar", "DynamoDBLocal.jar", "-sharedDb", "-inMemory"]
redis:
container_name: 'redis'
image: redis
ports:
- '6379:6379'
volumes:
local-data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment