What is Docker? What is the container?


Remember the old days when the developer’s favorite tool was SSH. We use to log in to the server using SSH and then pull our code using git and install all dependencies globally and then restart your application and server from the proxy, preferably Nginx. Everyone was happy. This setup probably worked for a long time, until it didn’t. Until some developer from your team relied upon another dependency and installed it on the production server and your service is down now. This brought a lot of problems such as no quick rollback, not easy to scale, very hard to debug.

Take another example when Jasmin said to Shashank, “I don’t know what’s wrong. The Same thing working fine on my machine”. Shashank said, “Let me check with Pavan if we can put your machine on the server.”

Consider another example when Viral decided to become Full-Stack. He said to Shashank, “I need three machines now as I need to run all front-end and back-end servers and want them isolated as well.” Shashank said, “Why don’t you create VMs.” But Viral found that most of his system memory was consumed by VMs and very little by actual applications.

Problems need to solve

Run multiple applications on the same host, but you need them to be isolated for security reasons. Scale, debug, rollback, etc.

Docker came to rescue

Docker is an open-source tool that uses the same “idea of isolation as VMs but without the extra overhead”. Docker allows applications to be packaged with all the dependencies installed and ran wherever wanted.

Docker container

A container is the standard unit of software that packages up code and dependencies so the application runs quickly and accurately from one environment to another.

How Docker is different from VMs

Docker vs Virtual Machine(VM)
  • Docker containers share the same system resources, they don’t have separate, dedicated hardware-level resources for them to behave like completely independent machines.
  • They don’t need to have a full-blown OS inside.
  • They allow running multiple workloads on the same OS, which allows efficient use of resources.
  • Since they mostly include application-level dependencies, they are pretty lightweight and efficient. A machine where you can run 2 VMs, you can run tens of Docker containers without any trouble, which means fewer resources => less cost => less maintenance => happy people.