To begin, you will start a Postgres Docker container in your terminal:
$ docker run --name postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=users -p 5432:5432 -d postgres
This will start a Postgres container with some basic setup:
- --name sets the name of the container
- -e allows us to set environment variables:
- POSTGRES_PASSWORD: The password used to access the database
- POSTGRES_DB: The name of the database
- -p allows us to expose port 5432 on the container to port 5432 on our local machine
- -d allows us to start the container in daemon mode (runs in the background)