Skip to content

Instantly share code, notes, and snippets.

@GuppuBoss
Forked from Da9el00/docker-compose.yml
Created September 23, 2024 12:09
Show Gist options
  • Save GuppuBoss/cfff63f30cce4ceda71944ee5ca7950f to your computer and use it in GitHub Desktop.
Save GuppuBoss/cfff63f30cce4ceda71944ee5ca7950f to your computer and use it in GitHub Desktop.
How to create a docker-compose setup with PostgreSQL and pgAdmin4
version: "3.8"
services:
db:
container_name: postgres_container
image: postgres
restart: always
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: test_db
ports:
- "5432:5432"
pgadmin:
container_name: pgadmin4_container
image: dpage/pgadmin4
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: root
ports:
- "5050:80"
@GuppuBoss
Copy link
Author

GuppuBoss commented Sep 23, 2024

Command to Run Postgres and PgAdmin locally

docker compose up
docker container ls -> copy running postgres container ID e.g. 7d12c0473f3a
docker inspect <CONTAINER_ID> -> and copy the IPAddress from the object. e.g. 172.18.0.3
Open PgAdmin localhost:5050 login and add a new server with IPAddress above

@GuppuBoss
Copy link
Author

docker images
It will print out all image already pulled on your laptop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment