Last active
May 9, 2024 07:11
-
-
Save crazyoptimist/a0a75fbf1412d359600a7281f8be4a4f to your computer and use it in GitHub Desktop.
PostgreSQL deployment using docker-compose
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
name: postgres | |
services: | |
postgresql: | |
image: postgres:16 | |
container_name: postgresql | |
environment: | |
- POSTGRES_USER=superuser | |
- POSTGRES_PASSWORD=youmayneverguess | |
- POSTGRES_DB=devdb | |
ports: | |
- "5432:5432" | |
volumes: | |
- postgres_data:/var/lib/postgresql/data | |
<<: &default_logging | |
logging: | |
driver: "json-file" | |
options: | |
max-size: "200k" | |
max-file: "10" | |
restart: always | |
pgadmin: | |
image: dpage/pgadmin4 | |
container_name: pgadmin | |
ports: | |
- "9000:80" | |
environment: | |
- [email protected] | |
- PGADMIN_DEFAULT_PASSWORD=pgadmin**pass | |
<<: *default_logging | |
restart: "no" | |
volumes: | |
postgres_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the service name(
postgresql
) or docker bridge network address(172.17.0.1 by default) for connecting from pgadmin.In MacOS though, docker bridge network is not accessible, so just use the service name.
OR you can also use
host.docker.internal