What is Docker?

Deepika Juneja
3 min readOct 19, 2022

--

Source: https://www.docker.com/

Most of the modern applications are a combination of multiple services. These services may include a web server, a frontend framework, a database server, and certain other tools for caching and orchestration.

Now, let’s say that when the application was in a developer’s local environment, it was working fine. But once it was moved to another machine, or to any other environment, it broke! Why did that happen?

Each of the services mentioned above has certain dependencies associated with it, in terms of OS, hardware, version etc. Whenever an application is moved to another environment, we need to make sure that it works the same, i.e., we need to configure the application with the correct versions of each of the services whenever we move it to another environment. This involves a lot of problems and is not an easy task to do…….

This is the exact situation where Docker comes to our rescue!!

Docker provides an efficient way to package your application, along with all the dependencies and any required infrastructure, into a single image. This enables the containerisation of application, which in turn helps to ship and run the application anywhere, any number of times.

Typically, docker solves the “works on my machine but not on theirs” problem.

Docker Image

A docker image can be defined as a blueprint of you entire application environment. Docker images are read-only or immutable, which is why they are also referred to as snapshots. They are supposed to be small and light-weight.

Docker images are of mainly 2 types:

  • Official Base Images: The ones which are pre-built and can be pulled from the registry.
  • Customised Images: The ones which use base images to create application-specific environments.

A docker image acts as a template or a set of instructions for creating docker containers.

Docker Container

A docker container is a packaged form of an application that has its own dependencies, and runs in its own environment.

Docker containers can be defined as completely isolated environments, which have their own processes (services), network interfaces and mounts, like VMs, but they also share the same OS. They enable the application to run quickly and reliably from one computing environment to another.

As per Docker,

Docker images become containers at runtime and in the case of Docker containers — images become containers when they run on Docker Engine.

You might be thinking that this concept of containerisation sounds similar to that of virtual machines and virtualisation. However, there are some differences. Let’s dive into those!

Containers vs Virtual Machines

Comparison between Virtual Machines and Docker Containers
  1. VMs require a separate OS, causing more resource allocation and poorer performance as compared to Docker containers.
  2. Docker containers are smaller and their usage promotes portability.
  3. Docker containers do not require any space to virtualise, hence there is lesser memory requirement.
  4. There is no delay in starting applications in Docker containers as the OS is already up and running. In contrast, VMs take a much longer time to run applications as they require to boot up the OS.
  5. Containers can be stopped, but VMs are always in running state.
  6. Container images are version controlled, whereas VMs are not version controlled.
  7. In VMs, multiple isolated OS environments can exist simultaneously on the same host machine, which is one of its advantages.
  8. Docker has complex usage mechanism, whereas VM tools are easier to work with.

For further learning, you can refer to the following course: https://www.udemy.com/course/learn-docker/

--

--

Deepika Juneja
Deepika Juneja

Written by Deepika Juneja

Application Developer at ThoughtWorks | Software Engineer | Tech Enthusiast | Potterhead

No responses yet