Journey from source to image .

Journey from source to image .

After we write a code for an application, we host it into the server. Hosting involves running your web app on a particular server. Hosting make the application available from a remote cloud infrastructure that is accessible through the Internet.

Now, How do we host applications?

Photo by [Austin Distel](https://cdn.hashnode.com/res/hashnode/image/upload/v1624531336769/9NN6Ge130.html) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)Photo by Austin Distel on Unsplash

In the past years, VMs (Virtual Machines) were the primary mechanism to host an application. VMs encapsulate the code, configuration files, and dependencies necessary to execute the application. A virtual machine, commonly shortened to just VM, is no different from any other physical computer like laptops, smartphones, or servers. However, it has a CPU, memory, disks to store your files and can connect to the Internet.

Virtualization is not possible without the hypervisor. A hypervisor, or virtual machine monitor, is the software or firmware layer that enables multiple operating systems to run side-by-side, all with access to the same physical server resources. The hypervisor orchestrates and separates the available resources (computing power, memory, storage, etc.), aligning a portion to each virtual machine as needed.

VM ArchitectureVM Architecture

However, using VM posed specific challenges as VMs require significant RAM and CPU resources.

As a result, the containers were introduced to make scaling up fast and easy.

Where shipping containers hold products comprising many different parts, a software container encapsulates an application — often a single executable service or microservice — along with its libraries, frameworks, and other components.

Multiple VMs on a hypervisor is replaced by numerous containers running on a single host operating system.

The processes in the containers are completely isolated but can access the OS filesystem, resources, and packages.

The creation and execution of containers are delegated to a container management tool, such as Docker.

Therefore, the containers are lightweight so that you can deploy multiple containers on a single server (or a VM) — no more dedicating an entire server to a single application. And you only have one OS to maintain. As a result, scaling up becomes fast and easy without the need for more server space.

What is a Container?

  • A Self-contained, sealed unit of software.

  • It contains everything required to run the code.

  • It includes batteries and OS

  • It has Code, Config, Processes, Networking, Dependencies, OS.

Consequently, there is a better usage of available infrastructure and a more efficient pathway to release a product to consumers.

The appearance of containers enabled organizations to ship products using a lightweight mechanism that would make the most available infrastructure. There are plenty of tools used to containerize services. However, Docker has set the industry standards for many years.

To containerize an application using Docker, three main components are distinguished:

  • Docker files: A Docker file is a set of instructions used to create a Docker image.

Docker File Example.Docker File Example.

  • Docker images: A read-only template that enables the creation of a runnable instance of an application.

# build the image

docker build -t go-helloworld .

# tag the image

docker tag go-helloworld aucodes/go-helloworld:v1.0.0

# push the image

docker push aucodes/go-helloworld:v1.0.0

  • Docker registries: The image needs to be pushed to a public Docker image registry to make it accessible to everyone.

Now, I assume you understood the basics, now onto the next phase.

The next stage in the release process is the deployment of the service. However, running an application in production signifies that thousands and millions of customers simultaneously consume the product. For this reason, it is paramount to build for scale. It is impracticable to manually manage thousands of containers, keeping these up-to-date with the latest code changes, in a healthy state, and accessible.

As a result, a container orchestrator framework is inevitable.

Checkout out the previous blog.

Stay Tune for more! Resources : https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ https://docs.docker.com/engine/reference/builder/#from https://docs.docker.com/engine/reference/commandline/tag/ https://buildpacks.io/docs/app-journey/