What is Docker?

Get introduced to docker and its advantages in this lesson.

Before defining what Docker is, we must understand what a container is and its importance in today’s tech ecosystem.

What is a container?

To make it simple, a container is a standard unit of software that packages up the software and all of its required dependencies so that the software or the application can run quickly and reliably from one machine to another, whether the environment or the OS.

An interesting definition from Solomon Hykes at the 2013 PyCon talk is containers are “self-contained units of software you can deliver from a server over there to a server over there, from your laptop to EC2 to a bare-metal giant server, and it will run in the same way because it is isolated at the process level and has its own file system.”

Note: Containerization is different from virtualization. Virtualization enables teams to run multiple operating systems on the same hardware, while containerization allows teams to deploy multiple applications using the same operating system on single hardware with their own images and dependencies.

Why should we use Docker?

Great, right? Remember at the beginning of this course when we had to make configurations and installations depending mostly on the OS for the Python executable, the Postgres server, and different commands to create and activate a virtual environment? Using Docker, we can have a single configuration for a container, and this configuration can run the same on any machine. Docker ensures that our application can be executed in any environment. Then, we can say that Docker is a software platform for building, developing, and developing applications inside containers. It has the following advantages:

  • Minimalistic and portable: Compared to virtual machines (VMs) that require complete copies of an OS, the application, and the dependencies, which can take a lot of space, a Docker container requires less storage because the image used comes with megabytes (MB) in size. This makes them fast to boot and easily portable, even on small devices such as Raspberry Pi-embedded computers.

  • Docker containers are scalable: Because they are lightweight, developers or DevOps can launch a lot of services based on containers and easily control the scaling using tools such as Kubernetes.

  • Docker containers are secure: Applications inside Docker containers are running isolated from each other. Therefore, a container can’t check the processes running in another container.

With a better understanding of what Docker is, we can now move on to integrating Docker into the Django application.

Get hands-on with 1400+ tech skills courses.