docker run -p 5432:5432 --name postgres_container -e POSTGRES_USER:postgres POSTGRES_PASSWORD=changeme -d postgres
Last active
April 29, 2022 00:13
-
-
Save gterdem/12a797d9869941822cfb074602e14c13 to your computer and use it in GitHub Desktop.
Docker compose for postgres and pgadmin
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
version: "3.8" | |
services: | |
postgres_db: | |
container_name: postgres_container | |
image: postgres | |
environment: | |
POSTGRES_USER: ${POSTGRES_USER:-postgres} | |
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme} | |
PGDATA: /data/postgres #optional | |
volumes: | |
- postgres_data:/var/lib/postgresql/data | |
ports: | |
- "5432:5432" | |
networks: | |
- postgres_network | |
restart: unless-stopped | |
healthcheck: | |
test: ["CMD-SHELL", "pg_isready -U postgres"] | |
interval: 10s | |
timeout: 5s | |
retries: 5 | |
pgadmin: | |
container_name: pgadmin_container | |
image: dpage/pgadmin4 | |
environment: | |
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} | |
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} | |
PGADMIN_CONFIG_SERVER_MODE: 'False' | |
depends_on: | |
- postgres_db | |
volumes: | |
- pgadmin_data:/var/lib/pgadmin | |
ports: | |
- "${PGADMIN_PORT:-5050}:80" | |
networks: | |
- postgres_network | |
restart: unless-stopped | |
networks: | |
postgres_network: | |
name: postgres_network | |
volumes: | |
postgres_data: | |
pgadmin_data: |
Author
gterdem
commented
Mar 9, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment