I've been trying to get my ahead around the purpose of docker for a couple of days now.
I found this answer very useful.
However, it raised more questions.
If I am deploying my app to Heroku, Azure, Rackspace, Netlify, etc — then should I consider Docker? If I'm maintaining my own package updates, making sure nothing breaks at the next deployment and that my dependencies are all in check, then what purpose would I have for Dockerizing my app?
Moreover, in the case of Heroku for instance, they give you the option to deploy with Docker. This makes no sense to me, and here's why.
Consider that I have a typical React app with a Node backend and MongoDB database. I can run create-react-app
to spin up my frontend and code out at most 15 lines in a single server.js
file to have my full stack app up and running in 3 minutes. What is the purpose of all of these images available on Dockerhub? Why would I need a Node image? Why would I need a MongoDB image, a React image? Why complicate everything that a package-lock.json
file would keep simple? Perhaps my understanding of "image" is incorrect?
How is adding arbitrary images of dependencies that are used by my project in any way useful? If I'm using MongoDB in my project, I'll need to add the npm package, add mongoose as well, and code out 5 lines of code to connect to my db on Atlas — where I'd have to do additional work, like building a cluster anyway. Why on earth would I ever need a docker image of MongoDB, if it'd be much easier to just npm install
it and keep a working, stable version of it in package-lock.json
?
By that logic, heck, why not just throw my whole dependencies
object out of package.json
altogether and use only docker images?
I'd appreciate some clarity on this. I understand the whole "quick new-hire deployment" aspect from the link I posted above, but Docker honestly just sounds and seems like an unnecessary overcomplication to me.