Introduction to Docker:

Spread the love

In this chapter, we will cover the following topics:

  • Docker Overview
  • The traditional architecture of Virtualization
  • The architecture of Docker
  • Steps to deploy Docker with AWS

Docker Overview:

  • According to Docker’s official website,
    • Docker is an open-source project to pack, ship and run any application as a lightweight container.
  • The idea is to provide a comprehensive abstraction layer that allows developers to containerize or package any application and have it run on any infrastructure.
  • The use of containers here refers more to the consistent, standard packaging of applications rather than referring to any underlying technology.
  •   The most common analogy used to help people understand Docker is saying that –
  •   Docker containers are like shipping containers: they provide a standard, consistent way of shipping just about anything.
  •   The whole idea of Docker is for developers to easily develop applications, ship them into containers that can then be deployed anywhere.

The traditional architecture of Virtualization:

  • The server is the physical server that is used to host multiple virtual machines.
  • The Host OS is the base machine such as Linux or Windows.
  • The Hypervisor is either VMWare or Windows Hyper V that is used to host virtual machines.
  • You would then install multiple operating systems as virtual machines on top of the existing hypervisor as Guest OS.
  • You would then host your applications on top of each Guest OS.

The architecture of Docker:

  • The server is the physical server that is used to host multiple virtual machines. So this layer remains the same.
  • The Host OS is the base machine such as Linux or Windows. So this layer remains the same.
  • Now comes the new generation which is the Docker engine. This is used to run the operating system which earlier used to be virtual machines as Docker containers.
  • All of the Apps now run as Docker containers.

Deploy Docker with AWS:

Amazon Elastic Container Service (Amazon ECS) is the Amazon Web Service you use to run Docker applications on a scalable cluster.

Step 1: Set up your first run with Amazon ECS (Elastic Container Service)

The Amazon ECS first-run wizard will guide you through creating a cluster and launching a sample web application. In this step, you will enter the Amazon ECS console and launch the wizard.

Step 2: Create a task definition

A task definition is like a blueprint for your application. In this step, you will specify a task definition so Amazon ECS knows which Docker image to use for containers, how many containers to use in the task and the resource allocation for each container.

Step 3: Configure your service

Now that you have created a task definition, you will configure the Amazon ECS service. A service launches and maintains copies of the task definition in your cluster. For example, by running an application as a service, Amazon ECS will auto-recover any stopped tasks and maintain the number of copies you specify

Step 4: Configure your cluster

Your Amazon ECS tasks run on a cluster, which is the set of container instances running the Amazon ECS container agent. In this step, you will configure the cluster, review security settings, and set IAM roles.

Step 5: Launch and view your resources

In previous steps, you have configured your task definition (which is like an application blueprint), the Amazon ECS service (which launches and maintains copies of your task definitions), and your cluster (which is the set of container instances running the container agent). In this step, you will review, launch, and view the resources you create.

Step 6: Open the Sample Application

In this step, you will verify that the sample application is up and running by pointing your browser to the load balancer DNS name.

Step 7: Delete Your Resources

Finally, you’ve launched three resources: an Amazon ECS cluster, an Amazon EC2 instance, and a load balancer. In this step, you will clean up all your resources to avoid unwanted charges.