Ok so, as a programmer, you probably switch from project to project, each of which has probably a different database, from PostgreSQL to MongoDB, etc.. and having all these database instances installed directly into our machine only for local development is quite useless.
To make matters worse the is also the versioning problem, maybe you have two (or more..) different projects, which are using PostgreSQL but they require two different versions of the DBMS, so what can you do?
Oh yeah, you can configure on your Linux machine manually a multi-version DB cluster but it seems a lot of work isn't it? Obviously, there is a better solution!
Why Docker is the Solution
With Docker, and specifically Docker Compose, you can have all your DBMSs in only one single configuration file, you can deploy, destroy, change the version, in a few keyboard digits.
Oh my god I need to migrate to my new laptop without keeping the old data, what can I do?
docker-compose up -d
And your databases are served!
On my god I have PostgreSQL 12 and I need also PostgreSQL 10, what can I do?
postgres10:
image: postgres:10
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: password
ports:
- 5432:5432
and again: docker-compose up -d
Ok I hate all the DBMS and since now I wanna work only with txt files on vim as a datastore.
docker-compose down
Now your laptop is clean. Nice Right?
As you can see, for local development is a piece of cake working with docker-compose
I highly recommend you check it out!
Extra Tip
Using the databases is good, but having a tool to inspect them is also good, and this is when adminer comes.
Adminer is a Database management Tool in a single PHP file, it works with a lot of relational databases, and it's super fast and lightweight.
This is a screenshot from adminer:
And you know? Adminer also works in docker! So in the same file, you can have your databases, and the tool to explore them!
PS: For MongoDB, you need something like mongo-express
because as i said before, adminer is for SQL database. But also mongo-express is docker ready, so no worries!
A Gift for You!
To thank you for your time to read this article, I decided to share the file that I use every day to develop my applications, you can find it Here on Github!
--
I am very curious if you have already worked this way or did not know this little productivity technique. Let me know with a comment below!
Do you have Twitter? Let's get connected! @itsrennyman
Top comments (1)
@itsrennyman Here is my helper article - dev.to/vishalraj82/using-https-in-...