How to Run PostgreSQL and pgAdmin using Docker

Today I needed to create a simple database to store some data. I decided to try PostgreSQL.
Cause I’m a bit intrigued by Docker, I decided to run it through a container.

Photo by Jan Antonin Kolar on Unsplash

At first, I used a docker-compose which I found online, everything worked but I had to interact with the database through the command line.

I searched for a different solution and I found pgAdmin.I decided to use pgAdmin and I had to find again a way to dockerize it.
I found a docker-compose file online but I had some troubles when I tried to upload a .csv to populate my DB.
It was impossible to upload the file through a drag and drop or to select a file outside the container.

In the end, I had to change the docker-compose file adding the volume attribute.
The following one is a working docker-compose:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store