In some cases you might want to have postgres setup on your machine. Let us understand how we can setup Postgres using Docker.
If you are using our labs, the database will be pre-created by us with all the right permissions.
If you are using Windows or Mac, ensure that you have installed Docker Desktop.
If you are using Ubuntu based desktop, make sure to setup Docker.
Here are the steps that can be used to setup Postgres database using Docker.
Pull the postgres image using
Create the container using
Start the container using
Alternatively we can use
docker run which will pull, create and start the container.
docker logs or
docker logs -f to review the logs to ensure Postgres Server is up and running.
docker pull postgres
docker container create
docker start itv_pg
docker logs itv_pg
psql -U postgres
psql -h localhost