Skip to content

Instantly share code, notes, and snippets.

@Narayana108
Last active September 24, 2021 18:52
Show Gist options
  • Save Narayana108/06d64e0699cbc8c165337ce9cbdda9a4 to your computer and use it in GitHub Desktop.
Save Narayana108/06d64e0699cbc8c165337ce9cbdda9a4 to your computer and use it in GitHub Desktop.
postgres - docker run and compose
# Username is postgres
# Database is postgres
version: '3.1'
services:
db:
image: postgres
restart: alwayshttps://gist.github.com/Narayana108/06d64e0699cbc8c165337ce9cbdda9a4
environment:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
volumes:
- database-data:/var/lib/postgresql/data/
adminer:
image: adminer
restart: always
ports:
- 8080:8080
volumes:
database-data:
docker run -d \
--name postgres_1 \
-p 127.0.0.1:5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v ~/Lab/volumes/postgres:/var/lib/postgresql/data \
postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment