Here is a simple docker-compose file to run PostgreSQL + pgAdmin services for your development needs.
Create a file docker-compose.yml.
Copy and paste the below code.
Run it using the command docker-compose up.
version: "3"
services:
db:
image: postgres
restart: always
ports:
- "54320:5432"
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
volumes:
- local_pgdata:/var/lib/postgresql/data
networks:
- postgres-pgadmin
pgadmin:
image: dpage/pgadmin4
restart: always
ports:
- "5050:80"
environment:
PGADMIN_DEFAULT_EMAIL: kiran@example.com
PGADMIN_DEFAULT_PASSWORD: password
volumes:
- pgadmin-data:/var/lib/pgadmin
networks:
- postgres-pgadmin
networks:
postgres-pgadmin:
volumes:
local_pgdata:
pgadmin-data:
You can access the pgAdmin at http://localhost:5050/
Top comments (0)