I try to learn something new every day, and I find it surprising what cool things you can do with technology.
Today I learned that you could run a PostgreSQL database in a docker container.
I was doing a Phoenix tutorial by Alvise Susmel.
The article shows you how to create a Phoenix app which can handle user uploads and is an interesting piece in itself. But I also like the idea of running the database in Docker for local development.
docker volume create postgres-db
We need the volume to store the data across sessions.
Launch the docker container from the command line:
docker container run --name postgres -p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-v poetic-postgres:/var/lib/postgresql/data \
--rm postgres:11-alpine