Set up the Chinhook Sample Postgres Database in Docker

S

Build Docker Image

In this tutorial we will set up the chinhook sample database in a docker container. To follow along with this tutorial you will need to have Docker installed, Git and some way to access the database.

The first step will be to build the docker image we will be using to stand up Postgres. To begin clone the repo https://github.com/monstarillo/monstarillo-templates. Open a command prompt and cd to the chinhook-db folder in the reop you just cloned. Create the docker image for our database with the command:

docker build -t monstarillo-postgres .
This image has an empty alt attribute; its file name is image-3-1024x684.png

This image includes the Postgres database and scripts to seed it with the Chinhook database schema and data. Create the container by running the following command replacing <Your Password> with the password of your choice:

docker run --name monstarillo-postgres -e POSTGRES_PASSWORD=<Your Password> -p 5432:5432 -d monstarillo-postgres

The JDBC URL for your database will be

jdbc:postgresql://localhost:5432/postgres

The default username is postgres and the default schema is public. The postgres user’s password will be the password you used in the docker run command above.

You have now set up the chinhook sample database in a docker container and logged in to test it.

Next you can try to Generate a Rest API Using Go For a Postgres Database or Generate a REST API Using Java for a Postgres database.

About the author

Patrick Wright

4 Comments

Patrick Wright

Get in touch