Skip to content

Create PostgreSQL Docker container and connect form NodeJS

License

Notifications You must be signed in to change notification settings

vlada-j/Node-Postgres-Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node-Postgres-Docker

Create Postgres Docker container and connect form NodeJS

Create Docker container

Build the Docker image from Dockerfile. Run command in the same directory.

docker build -t my-pg-img .

Create container of that image

docker run -d -p 5432:5432 --name my-postgres-container my-pg-img

Test if it is running

docker ps -a

Test App

npm install

Run server with local environment variables

npm run start:local

Note: For Windows use set NODE_ENV=local, but for Linux us NODE_ENV=local

For different environment (like dev or prod) use different .env file and before run set that environment

About

Create PostgreSQL Docker container and connect form NodeJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published