Why do we need Docker?
Imagine you have an application running on Windows with Node v1 and DB v2. A new teammate joins and wants to set up the same environment on their macOS system to work on the app. They start installing everything manually—Node, the database, and other dependencies—but instead of using the same versions, they install the latest ones (say Node v3 and DB v2 ).
While replicating the setup, issues start popping up: some commands work on Windows but not on macOS, some errors occur because of version mismatches, and the entire manual process becomes error-prone. This might still be manageable in a small team, but as the team grows, it wastes a lot of time.
That’s exactly where Docker comes in—it solves these kinds of issues by ensuring consistent environments across different systems.
What is Docker?
Docker is basically a tool that lets us create and run containers. You can think of it as a containerization platform since its main job is to build and manage containers.
Containerization means packaging your application along with all its dependencies (libraries, settings, and system tools) into a single container. The best part is that it works the same way regardless of the operating system.
What is a Container?
A container is a single unit or bundle that contains an application and its details, such as all dependencies, libraries, and configurations.
Docker containers have some properties:
the term "portable" refers to the ability to run Docker containers consistently across different environments , you can package an application (along with all its dependencies, libraries, and configuration) into a Docker image .
You can run the same container on Windows, macOS, Linux, or cloud environments without worrying about compatibility.
Lightweight in nature. It is simple to create these containers and update containers to have multiple containers on a single machine, as well as delete these containers.
Example: On a local machine, we can build two Node.js applications using separate versions—for example, one container with Node v16 and another with Node v20—and these containers will maintain their own versions irrespective of the host system, as Docker containers can run different versions of the same dependencies across applications.
![docker]()
Isolation: Each container runs independently, and there is no interference between containers.
Scalability: Easily scale applications up or down using multiple containers.
What is a Docker Image?
A Docker image is like a blueprint that contains everything needed to run an application (code, dependencies, and configuration), and from this image, we can create one or many containers .
The relationship between an image and a container is similar to a class and its objects in programming—a single image can produce multiple containers.
When sharing applications, we share the image , not the running containers.