Skip to content

Instantly share code, notes, and snippets.

@aryanprince
Last active March 1, 2024 23:17
Show Gist options
  • Save aryanprince/f4257d77c81109aed086dbae40f61fd8 to your computer and use it in GitHub Desktop.
Save aryanprince/f4257d77c81109aed086dbae40f61fd8 to your computer and use it in GitHub Desktop.
Setting up Postgres and MySQL locally using Docker Compose
version: "3.9"
name: myprojectname-mysql
services:
# This is your local MySQL database instance
mysql-db:
image: mysql
restart: always
environment:
MYSQL_DATABASE: myprojectname
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: dev
MYSQL_PASSWORD: dev
volumes:
- myprojectname-data:/var/lib/mysql
ports:
- "6969:3306" # Access the DB at port 6969
# Use Adminer to quickly view the database at localhost:8069
adminer:
image: adminer
restart: always
ports:
- "8089:8080"
volumes:
myprojectname-data:
driver: local
version: "3.9"
name: myprojectname-postgres
services:
# This is your local Postgres database instance
postgres-db:
image: postgres
restart: always
environment:
POSTGRES_DB: myprojectname
POSTGRES_USER: dev
POSTGRES_PASSWORD: dev
volumes:
- myprojectname-data:/var/lib/postgresql/data
ports:
- "6969:5432" # Access the DB at port 6969
# Use Adminer to quickly view the database at localhost:8069
adminer:
image: adminer
restart: always
ports:
- "8069:8080"
volumes:
myprojectname-data:
driver: local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment