Skip to content

Instantly share code, notes, and snippets.

@ABSphreak
Created March 17, 2024 12:01
Show Gist options
  • Save ABSphreak/26ff6b2c04ca354699bc93ba4ef91368 to your computer and use it in GitHub Desktop.
Save ABSphreak/26ff6b2c04ca354699bc93ba4ef91368 to your computer and use it in GitHub Desktop.
Docker compose file for Postgres and MongoDB together
version: '3'
services:
postgres-db:
image: 'postgres:latest'
ports:
- 15432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 123
POSTGRES_DB: dev-user-db
networks:
- postgres-network
volumes:
- ./.docker-volume/postgres-data/:/var/lib/postgresql/data/
mongo:
image: mongo:latest
restart: always
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: mongo
MONGO_INITDB_ROOT_PASSWORD: 123
networks:
- mongo-network
volumes:
- ./.docker-volume/mongo-data/:/data/db
networks:
postgres-network:
driver: bridge
mongo-network:
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment