Last active
September 24, 2021 18:52
-
-
Save Narayana108/06d64e0699cbc8c165337ce9cbdda9a4 to your computer and use it in GitHub Desktop.
postgres - docker run and compose
This file contains 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
# 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: |
This file contains 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
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