A container (in general, not only in Docker) is an isolated process, with everything it needs to function with no reliance on any pre-installed dependencies on the host machine.

Containerization is the technique to solve the “it works on my machine!” problem, where a program works on a machine because it has a series of dependencies (libaries and other tools with a certain version) and not on other machines (different OS, different libraries, different versions.)

By incapsulating the application inside of a container, it can be easily pulled and ran without having dependency problems.

A container is: ^[What is a container? | Docker Docs]:

  • Self-contained. Each container has everything it needs to function with no reliance on any pre-installed dependencies on the host machine.
  • Isolated. Since containers are run in isolation, they have minimal influence on the host and other containers, increasing the security of your applications.
  • Independent. Each container is independently managed. Deleting one container won’t affect any others.
  • Portable. Containers can run anywhere! The container that runs on your development machine will work the same way in a data center or anywhere in the cloud!

Container vs Virtual Machine

A virtual machine is an entire operating system, while a container is a simple and more lightweight isolated process with all the files it needs to run. Spinning up a VM for each process will be very heavy.

All the containers share the same underlying OS components, reducing the overhead (there is absolutely no need for each container to have it’s own independent OS).

Container vs Image

An image is like a photo, a container is like a copy of a photo.


docker