Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 648 Bytes

postgres_with_docker_compose.md

File metadata and controls

32 lines (26 loc) · 648 Bytes

Running scripts using docker compose

We will be getting up Postgres and a simple script to run as containers using docker compose.

Run Docker Compose

cd DevOps-Workshop1
docker compose up -d

Working with database.

  1. Login to database container as a postgres user.
docker exec -itu postgres workshop_postgres bash
  1. Login to postgres
cd  # this will amke the directory to postgres users home directory
psql # To login to postgres
  1. Create a database
CREATE DATABASE e_commerce;
  1. Dump schema.sql file to e_commerce database
psql -U postgres -d e_commerce < /var/lib/schema/schema.sql