While working on my local development, I always get frustrated when it takes more time to run build process than actually writing the code or in making any change. Because we are more eager to see the result and move fast to run multiple iterations for things we are building. Be it design, logical changes in program or fixing some bugs.
Sometimes it happens that we spend our 60% time in just waiting for the build operation.
There are two possible reasons when the build process cannot be effective.
- Poorly automated build process
- Not enough resources to run the process
When you are sure that the build process is effectively automated, next trigger goes to the resource utilization. What if the setup itself eats too much of your machine resources like memory, CPUs?
While going through my checklist in the build process and local setup, only the thing which causes the bottleneck for the local resources was the virtual machine. There are many reasons why we use virtual machines in local development but majorly listed-
- Having the same setup as production
- In this way, you keep your host machine safe from any system level changes
- While working on multiple projects no interference and no conflicts
But this also comes with the problems of that-
- It’s slower than working directly on the machine
- You need enough resource to run virtual machines
Till now I’ve been using Vagrant for running virtual machines in local. Using Vagrant was not of a problem when I was working on multiple services using the same development environment. But the problem started when I needed the different development environment for the services. Now in order to have the different environment, I required running multiple virtual machines, which was not effective approach at all.
Docker is a container management that can consistently run software as long as a containerization system exists. Containers are generally more lightweight than virtual machines, so starting and stopping containers is extremely fast. Docker describes itself-
Developers use Docker to eliminate “works on my machine” problems when collaborating on code with co-workers. Operators use Docker to run and manage apps side-by-side in isolated containers to get better compute density. Enterprises use Docker to build agile software delivery pipelines to ship new features faster, more securely and with confidence for both Linux, Windows Server, and Linux-on-mainframe apps.
I got introduced to Docker in early 2014 while watching Introduction to Docker. In first few experiment while learning, I was not able to give time and found Vagrant to sufficient for my setup requirements. Also while experimenting with it, I had problems with persistent storage for logging setup in production.
If you are new to Docker and want to learn more about it, follow this getting started article by Docker.