What problems does Docker really solve? 🐳
Tags: docker, beginners, devops, tutorial
Published: 2020-01-18 10:04:04

Docker is becoming more and more popular and seems like every company is now turning to it to make the development and deployment process more efficient. The reason is that docker solves some common problems that have been around for quite a while in software development.
 

***CONTEXT***

Most of the modern applications have similar setups. They all use a combination of different technologies to assemble a complete application functionality. An example would be an app that uses combination of following services:

- Node.js for Webserver

- ReactJs for frontend

- MongoDb as a database 

- Messaging system - Redis 

- Orchestration tool - Ansible


![alt text](https://static.wixstatic.com/media/a11f24_8e16ad4f1c1d436da491d6382cb1d2e1~mv2.png)



Now if you have a little development experience, you already know that these technologies each have a version the application depends on. Also the application isn’t an isolated thing that just floats around. It needs to run in an environment, which could be a development, test or a production environment. Since the environments can differ in OS, version, hardware etc, it’s obvious that the application and its technologies with their respective versions should work the same on different environments. 

 

Without docker, this means that each environment that the application runs on (local dev environment, a test or production server) needs to be configured with the correct versions of these services so that application can run properly.

![alt text](https://static.wixstatic.com/media/e7182f_b4603064a51b40a1a12888d79786a2db~mv2_d_1920_1281_s_2.jpg)


***So the following PROBLEMs arise***

- Compatibility of each service with the underlying OS 

- Compatibility of each service with the libraries and dependencies of OS (One service requires versionX of OS library. Another service - versionY of same library) 

- Every time version of any service updates, you might need to recheck compatibilities with underlying OS infrastructure 

- “Matrix from Hell" 

- For a new developer to setup the environment with right OS and Service versions 

![alt text](https://static.wixstatic.com/media/a11f24_9c7efe10858f494f95a809cb7f81354c~mv2.png)


***Docker SOLUTION***

- Each service has and can manage its required OS dependencies for itself, bundled and isolated in its own container  

- Change the components without affecting the other services 

- Change underlying OS without affecting any of the services 

 

As a result, docker should avoid the typical “works on my machine” cases. In the development process, for example, developers and testers will have the identical environments where the application runs, since this environment is packaged in docker containers, which just like a file, can be transferred around as an artifact.

![alt text](https://static.wixstatic.com/media/a11f24_62731ad5cf7641e6a5422f49af385b0e~mv2.png)

Also to make things easier for developers, there are already hundreds of ready docker images with different environments in the official docker repository. For example, if I need a Postgres DB for local app development, I can just pull a ready Postgres image with the version I need and with a single command I can have a Postgres DB running locally. Even better, if I need 2 different versions of Postgres DB for 2 separate applications, no problem too. I can pull the second docker image and start another Postgres instance with a different version using a single command. 


----------
[Complete and FREE Kubernetes & Docker course on Youtube](https://www.youtube.com/playlist?list=PLy7NrYWoggjwPggqtFsI_zMAwvG0SqYCb)