What is Docker?

Avindu Dharmawardhana
4 min readJan 4, 2024

CONTAINERIZATION

Before staring with Docker let’s move to containerization topic.

Containerization is the process that manges our applications, codes through an isolated environment. Containers are the isolated environments that have for a particular code.

Containers do not have any knowledge about the operating system, applications or other files as well. When consider with Docker, Docker desktop used to manage the containers.

Virtual machines vs Containers

Virtualization is the technology that used to create virtual representations of servers, storage, networks, and other physical machines.

Virtual machines mimics the functions of physical hardware to run multiple virtual machines simultaneously on a single physical machine.

As in the above definition, virtual machines are differ with containers how the operating system and hardware for particular applications are used. Using VMs or containers help to manage the resources in businesses and other projects as well.

About vms: https://aws.amazon.com/what-is/virtualization/#:~:text=Virtualization%20is%20technology%20that%20you,on%20a%20single%20physical%20machine.

Why Docker?

When the apps working in a monolithic way, different system requirements needed for deploy those applications.

As shown in the above image, different projects works with different combination of websites, Databases, frontends and endpoints.

So according to these requirements shipping the whole distributed app is a difficult task.

So developers needed a simple distribution and packaging system for those apps

As shown in the below image, docker works as the ‘container’ for packing the

Requirements that needed for run the apps in different systems(for an instance different os used to different apps running).

Docker files, Docker images and Docker Containers

· Docker image is the basis of a Docker container. It represents how the application stored . Note that, Docker image is read-only templates that storing the application Binaries and dependencies.

· Docker container is the standard unit that residing the application service and executing it.

However, Docker containers can’t executes without a Docker engine.

· Docker engine Creates,ships and runs the deployable containers on a

Physical, virtual or local hosted datacenter or a service provider.

· Docker registry service allows to use cloud or server based storage and distribution services(Amazon Elastic Container Registry, Google Container Registry, Azure Container Registry) for the Docker images.

By default, Docker engine interacts with the DockerHub which is Docker’s

Public registry instance.

Given in the below describes the simple steps to create and run a container

As above image shows simply when a Docker file runs Docker image is created.

When Docker image runs container is created.

Simply we can tell when the docker image runs it creates an object that called container.

Which are the light weighted and isolated environments contains applications and the dependencies.so docker container is a instance of a docker image.

Running a container

As a start let’s look on how to run a simple docker container with building a docker image.

Step 1:Clone the provided application to the machine.

command : git clone https://github.com/docker/welcome-to-docker

Step 2:Set the path from cmd to the folder where the docker file exists.

command : cd welcome-to-docker

Step 3:Create the docker image from the docker file

command : docker build -t welcome-to-docker

In the above command –t flag tags the image with the name welcome-to-docker(I used the docker image file name also as the welcome-to-docker).

As shown in below docker image has built.

Step 4:Run the docker container from the image that has been created using docker desktop.

  • *correction* : container name including not mandatory.

If the container runs properly in the port given, we can see the frontend of the application.

As shown in the belowimage, we can see what are the running containers currently in our browser.

--

--