https://github.com/nithink-142/express-postgres-api
https://github.com/nithink-142/express-postgres-api
docker docker-compose express postgresql
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nithink-142/express-postgres-api
- Owner: nithinK-142
- Created: 2024-12-21T10:10:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-25T09:53:43.000Z (over 1 year ago)
- Last Synced: 2025-04-08T22:47:33.610Z (about 1 year ago)
- Topics: docker, docker-compose, express, postgresql
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Express PostgreSQL API
## Setup PostgreSQL using Docker
### Prerequisites
- Download and install [Docker Desktop](https://www.docker.com/products/docker-desktop/).
- Install the pgAdmin extension within Docker.
### Steps
#### Pull the PostgreSQL Image
```bash
docker pull postgres
```
#### Run the PostgreSQL Container
```bash
docker run --name postgres-db -e POSTGRES_PASSWORD=8080 -p 5432:5432 -d postgres
```
**Note:** Port mapping is dynamic in this setup to avoid errors that occurred when specifying a static port.
#### Connect to pgAdmin
- **Host Name/Address:** `host.docker.internal`
- **Port:** Dynamic (it changes each time the container runs).
#### Connect to the Container
```bash
docker exec -it postgres-db psql -U postgres
```
## Useful Docker Commands
### View All Running Containers
```bash
docker ps
```
### Inspect Container Details
```bash
docker inspect
```
### Start/Stop a Container
- Start:
```bash
docker start postgres-db
```
- Stop:
```bash
docker stop postgres-db
```
### If Port Not Available error
- Start:
```bash
net stop winnat
```
- Stop:
```bash
net start winnat
```