Docker – Setting Up DB for Nest JS

Docker configuration for Nest JS, PostgreSQL. Docker basic commands and db setup tutorial

Create docker config file :

docker-compose.yml

version: '3.8'
services:
  dev-db:
    image: postgres:13
    ports:
      - 5434:5432
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 123
      POSTGRES_DB: nest
    networks:
      - smartcoder
networks:
  smartcoder:

Save this file in the root of the project directory

Run the Command

docker compose up dev-db -d

dev-db is give as the service in the docker config

Now try this command to get the list of active containers in the docker

docker ps

docker logs 689ef89db8f3

689ef89db8f3 – is my container id which i got from above docker ps execution

After executing the logs i can get the status of the running container

About the Author: smartcoder

You might like

Leave a Reply

Your email address will not be published. Required fields are marked *