Often I test some stuff on my MacBook. Mostly database and data store related stuff (MongoDB, MariaDB, Postgres). I install the software with Homebrew and test.

I wonder if I should switch to docker? What are pros and cons Homebrew vs. Docker for testing things on local Desktop?


One of the advantages of using Docker would be that you can easily run tests with different versions of the (DB) apps, which could be quite difficult with Homebrew (some apps don't easily support multiple versions installed on the same system).


One of the cons of Homebrew for the use of testing your DB stuff is how tightly coupled the DB is to your local environment.

You'll inevitably end up needing to manage the details of what services are running, and possibly needing to manage the versions of multiple installations. This can get complex if you need to install software that needs different versions of dependencies, or if you need to pin a very specific version on your test DB.

Docker can probably be a good fit for your usecase.

One of the pros of Docker is the ability to quickly set-up and tear-down. Here's an example:

Because containers have their own filesystem that is isolated from your host, you can start up a mysql:5.6 container, perform whatever operations you need to do for your testing, and stop the container. You can start up another mysql:5.6, (or even a mysql:5.7 container), and it will not matter than you could have destroyed that first container. The instances are independent of each other.

You can even easily stand up several DBs, and do some very complex A-B testing that would take a lot more effort if you were to manage the process with a homebrew installation.

It was not mentioned as a need for your usage, but Docker makes it easier to work with developers who use different operating systems, (but can also run docker locally). You can write one set of local development setup/test scripts, and it will generally not require any changes in order to have the same results.

It's a great tool for filtering out "it works on my machine".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.