Last active
October 12, 2023 16:03
-
-
Save mevlanaayas/4946866bc1547d5421b93146d5775674 to your computer and use it in GitHub Desktop.
Docker compose file to run postgresql and mongodb locally
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.1' | |
services: | |
docker-postgres: | |
image: postgres:11.1 | |
container_name: docker-postgres | |
volumes: | |
- path/to/volume:/var/lib/postgresql/data | |
environment: | |
- POSTGRES_USER=docker | |
- POSTGRES_DB=docker | |
- POSTGRES_PASSWORD=docker | |
ports: | |
- local_port:5432 | |
networks: | |
- default | |
restart: always | |
docker-mongodb: | |
image: mongo:4.0.5 | |
container_name: docker-mongodb | |
volumes: | |
- path/to/volume:/data/db | |
ports: | |
- local_port:27017 | |
networks: | |
- default | |
restart: always | |
networks: | |
default: | |
external: | |
name: docker_default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Volumes: are optional, they provide consistent data.
Images: versions are optional, choose what best fits for you.