TL;DR; Because Docker is cool! Actually, really cool because Docker enables DevOps for Infrastructure as Code.
When I develop code its on my own laptop. Typically running in a local web server with the back end, front end and database all running close together. Very seldom does this match what we experience when we take our systems into production.
My production environment typically consists of a number of back end servers fronted by a load balancer, possibly with auto scaling functionality. The database is running somewhere else, possibly in a server-less cloud environment. The front end, where possible, is hosted on static storage to best serve as many end users as possible. In fact the whole environment could be server-less if its on a cloud provider.
So matching our local environment to look and behave like our production environment is really difficult.
Docker to the rescue. Docker allows me to start up multiple “servers” all on my own laptop. So I can easily create 2 or 3 back-end servers. Another server to host my front-end (statically). I can start up my database on its own server so it looks like it is remote and serverless. All this can be accomplished with a few configuration files that start it all up for me when I need it. Along with Docker we can start up Kubernetes locally to do our auto scaling.
So if I have configuration files to start up my “production” environment I am effectively doing Infrastructure as code. If I want to test it out on a different operating system I just update the config files and away I go.
If I want to be really clever I use Terraform as my Infrastructure as Code scripting language, store it in a Git repository, automate the process with Git hooks to restart the whole environment when I change my Terraform scripts. And suddenly I have a DevOps ecosystem running locally on my own Laptop. Now that is Cool!
Now all I need is a Laptop from work that can run my Docker farm!
PS. Preferably an i7, 8 cores, and 32GB of RAM please, and no I don’t need a touch screen thank you very much.
PPS. Actually 64GB of ram would be even better! (Because my 24GB home laptop still doesn’t like running more than 10 docker instances at a time!)
These are my opinions made in my personal capacity, and may not match those of my employer.