Beginner's Guide to Containerization with Docker

Containerization

  • Containerization is process of packaging the application along with its dependencies.

What is virtual machine

  • VMs are called as hardware level virtualization.

  • VMs are created using Hypervisor

  • VMs are used to run the operating system

  • VMs will continue to run even if there is no active applications/tasks

  • VMs consume more space and time to start and run the applications/tasks

What is Container

  • Containers are called as OS level virtualization.

  • Containers are created using container engine.

  • Containers are not used to run the operating system

  • Containers will immediately go to exit state if there is no active applications/tasks

  • Containers consume less space and time to start and run the applications/tasks.

  • Containers run in its own address space.

  • Containers are used to reduce the number of VMs.

Use cases

Infra-Structure Perspective

  • Without using containerization

    • Jenkins_Master Node(VM) - Create the CI/CD Pipeline Projects and schedule to run in slave nodes.

      • Jenkins_Slave_Node1(VM) - Java Application Build maven

      • Jenkins_Slave_Node2(VM) - Python Application Build

    • While using this approach more number if VMs will be used for each slave node.

  • With using containerization

    • Jenkins_Master Node(VM) - Create the CI/CD Pipeline Projects and schedule to run in slave nodes.

      • Jenkins_Slave_Node1(VM)

        • Container 1 - Java Application Build maven

        • Container 2 - Python Application Build

    • While using this approach less number of VMs will be used.

Developers'/Deployment Perspective

  • Environment

    • Dev Environment (VM)

      • Create Source Codes
    • Build Environment (VM)

      • Build Application Artifacts ===> mywebappsvc1_v1.0.war

      • Unit Test the Application

        • Using jdk17 & tomcat8.5 - mywebappsvc1.war has been tested successfully.
      • Package the Applications along with its dependencies :

        • Package is also called an Container Image.

        • (mywebappsvc1.war,jdk17,tomcat8.5) --> mywebappsvc1-img_v1.0

      • Publish the Application Image to the Container Registry

        • mywebappsvc1-img_v1.0
      • Promote the mywebappsvc1.war to Target Server

    • Testing Environment (VM)

      • QA (VM) - Quality Assurance Testing

        • Download the Application Image mywebappsvc1-img_v1.0 from Container Registry and Create Container out of it to run the application.
      • UAT (VM) - User Acceptance Testing

        • Download the Application Image mywebappsvc1-img_v1.0 from Container Registry and Create Container out of it to run the application.

Docker Container Engine and its Architecture

Architecture Components/Terminologies :::

Docker Container-Engine :

  • Used to create and manage container images and containers.

Container Image

  • Container images are the static file that defines the properties and the dependencies.

  • Container images are not executable.

  • It composed of various layers create based on the docker instructions.

Containers

  • Containers are the executable unit of the container images.

  • Containers are used to run the applications defined in the container images.

Container Registry

  • It is used to version control/Store and manage the container images.

  • Docker hub is the container registry to be used.

Container Repository

  • Container Repository are the subset of container registry.

Docker CLI Command

  • Used to interact with Docker Engine.

Install Docker Container Engine