Container technology – Part1

container technology

Outline;

  • What is container (containers 101)
  • How it works (Sample)

This article can be seen as a start for people who are curious about how Container technology works and who want to develop it.

I used Dockers container content in my article, that’s because I found it most presentable.

What is container?

Container technologies basically an approach to software development in which pieces of code are packaged in a standardized way. By this way, they can quickly be plugged in and run on the pre-defined operating system.

Container, “A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. Available for both Linux and Windows-based apps, the containerized software will always run the same, regardless of the environment.

Some basics about the container and Virtual machine.

  • The container is an abstraction at the app layer that package code and decencies together.
  • Each container running as isolated processes in userspace.
  • Contaıners takes less space than virtual machines.
  • Containers are much more rapid than virtual machines, it starts almost instantly.

 

  • Virtual machines are an abstractıon of physical hardware.
  • There is a hypervisor manages to virtual machines to run on a machine.
  • Each virtual machine includes a full copy of an operating system.
  • Virtual machines can take up tens of GBs.
  • Virtual machines can also be slow to boot.

 

Also, Virtual machines and container technologies can be used together, depends on your architecture.


How it works

In this section, I’ll show you how to set up a simple Docker container.
First, you need to download the appropriate Docker software to your computer. It can be desktop, cloud or server versıon of it.

Setup instructions

If you install Docker CE first time on a new machine, you need to set up the Docker repository.

[doc1]-docker-installation

Get started

The container type you want to install, the version you want to add to the network or media you want to add the file DockerFile.

Example DockerFile:

[doc2]-getstarted

This Dockerfile refers to a couple of files we haven’t created yet, namely app.py and requirements.txt. Let’s create those next.

App.py

[doc3]-app

Requirements.txt

[doc4]-requirements

Now we see that pip install -r requirements.txt installs the Flask and Redis libraries for Python, and the app prints the environment variable NAME, as well as the output of a call to socket.gethostname(). Finally, because Redis isn’t running (as we’ve only installed the Python library, and not Redis itself), we should expect that the attempt to use it here will fail and produce the error message

Now you need to build the app:

[doc5]-build

and, here it is:


Once the installation is finished, you can store this Image for later use by uploading it to the repository you created earlier.

[doc6]-share

You can download and use the images that others have already created in this way.

By the way, if you are curious about how WannaCry (Ransomware) works, you may want to check: https://pengs.win/the-fact-of-ransomware/

References,

 

Related posts

Leave a Comment