Notes taken by Horeb S

Links

🔗 Link to the video

🔗 Alexey’s notes

Table of contents


Setting up Postges with Docker

In this part of the course, we will learn how to run PostGres in Docker and then, ingest a Database in it. The code to run PostGres in Docker is as following :

docker run -it \\
	-e POSTGRES_USER="root" \\
	-e POSTGRES_PASSWORD="root" \\
	-e POSTGRES_DB="ny_taxi" \\
	-v ny_taxi_postgres_data:/var/lib/postgresql/data \\
	-p 5432:5432 \\
	postgres:13

Let's break down this command to understand what each flag does:

POSTGRES_USER="root" is the username we want to set for accessing our PostgreSQL database. In this case, we're using "root" as a simple example, though in production we'd want to use a more secure username. POSTGRES_PASSWORD="root" sets the password for accessing the database. Again, in a production environment, we would use a much stronger password. POSTGRES_DB="ny_taxi" specifies the name of the database that will be created when the container starts up.

If everything is running smoothly then you will see a bunch of files generated in the ny_taxi_postgres_data folder.

How to access the database inside the container ?

PGCLI