Debug School

Rajesh Kumar
Rajesh Kumar

Posted on

Day 1 Docker - Assignment

What is Docker?
Why We need docker?
What is Container?
How Container Works?
How to install Docker?
What are the components docker?
What is a container lifecycle commands?
What is docker pause/unpuase?
What is docker stop/kill?
How to get inside a container?
How to access container from outside?
What is the rule for container is running?

Top comments (3)

Collapse
 
selectravimca_399 profile image
Ravi Banka

What is Docker?
Docker is Container anagement software platform whic i ueful to build ,test and deploy applications at ease
Why We need docker?
Using Docker, Org is getting benefits in terms of time,money and cost savings on resources. No Infrastructure maintainance needed
What is Container?
Container is a lightweight, standalone, executable package of software that includes everything needed to run an application
How Container Works?
Container wraps your software process or microservice to make it executable in all computing environments. In general, you can store all kinds of executable files in containers, for example, configuration files, software code, libraries, and binary programs.
How to install Docker
We have plenty of options and I am adding 2 option here
Windows - We can install throgh installation set up
For Linux/Unix-

apt-get update
Run as root user like Sudo -i
yum install Docker
What are the components docker?
The basic components include Docker client, Docker image, Docker Daemon, Docker Networking, Docker registry, and Docker container
What is a container lifecycle commands?
Start,Run,Pause,Stop,Delete,Kill
What is docker pause/unpuase?
Pause - Memory portion stay intact
Unpause -un-suspends all processes in the specified containers
What is docker stop/kill?
Stop - To terminate the process safely
Kill- To terminate the process immidiately and forcebly
How to get inside a container?
docker exec -it \bin\bash
How to access container from outside?
by pointing to port number like -P or -p
What is the rule for container is running?
PID should be up and running

Collapse
 
sati1241_119 profile image
Satish

What is Docker?

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. The service has both free and premium tiers. The software that hosts the containers is called Docker Engine.

Why We need docker?

Because Docker containers encapsulate everything an application needs to run (and only those things), they allow applications to be shuttled easily between environments.

Docker enables more efficient use of system resources. Instances of containerized apps use far less memory than virtual machines, they start up ...

What is Container?
A container is a unit of software that packages code and its dependencies so the application runs quickly and reliably across computing environments.

How Container Works?

Containers are an abstraction in the application layer, whereby code and dependencies are compiled or packaged together. It is possible to run multiple containers on one machine. Each container instance shares the OS kernel with other containers, each running as an isolated process.

How to install Docker?

You can download and install Docker on multiple platforms. Refer to the following section and choose the best installation path for you.

What are the components docker?

You can download and install Docker on multiple platforms. Refer to the following section and choose the best installation path for you.

1 Docker Installation in Centos/RHEL
1.1 Method -1: How to install Docker Community Edition via YUM?
1.2 Method – 2: How to install Docker Community Edition via RPM Packages?
1.3 Method – 3: How to install Docker Community Edition via script?
2 Docker install in Ubuntu
3 How to Install Docker in RHEL8 / RHEL9 / CENTOS8 / CENTOS9?
I used the below method
Docker provides convenience scripts at get.docker.com.
Step 1 – Download and Run the script.

$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
Step 2 – Enable Docker

$ sudo systemctl enable docker
Step 3 – Start Docker

$ sudo systemctl start docker
Step 4 – Verify that docker is installed correctly by running the hello-world image.

$ sudo docker run hello-world

What is a container lifecycle commands?

CREATE -> START -> STOP -> START -> RESTART -> PAUSE -> UNPAUSE -> KILL -> REMOVE

What is docker pause/unpuase?

Paused / Unpaused state

So, as the container is running, there must be a way to pause it. We can do so by running the pause command. This command effectively freezes or suspends all the processes running in a container. When in a paused state, the container is unaware of its state.

docker pause container

It basically sends the SIGSTOP signal to pause the processes in the container.

Similarly, to get the paused container back on running, we’d use the docker unpause command:

docker unpause container

What is docker stop/kill?

For a container to be in a killed state, we run the docker kill command, which sends SIGKILL signals to terminate the main process immediately. This means the difference between docker stop and docker kill is that - stop can allow safe termination (within the grace period) while kill terminates immediately.

How to get inside a container?

Once you have your Docker container up and running, you can work with the environment of the Docker container in the same way you would do with an Ubuntu machine. You can access the bash or shell of the container and execute commands inside it and play around with the file system. You can build, test, and deploy your applications inside the container itself.

Predominantly, there are 3 ways to access the shell of a running container. These are -

Using the Docker run command to run a container and access its shell.
$ docker run -it --name=myubuntu ubuntu:latest bash
Using the Docker exec command to run commands in an active container.
$ docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
$ docker exec -it myubuntu bash

Using the Docker start command and attach a shell to a stopped container.

$ docker start [OPTIONS] CONTAINER [CONTAINER...]
$ docker container ps -a
$ docker start -ai myubuntu

How to access container from outside?

In order to make a port available to services outside of Docker, or to Docker containers which are not connected to the container's network, we can use the -P or -p flag. This creates a firewall rule which maps a container port to a port on the Docker host to the outside world.

Accesss from Outside === Network

65 docker inspect 955a249cbf71
66 docker ps
67 curl 172.17.0.9
68 ping "172.17.0.9"
69 history

What is the rule for container is running?

The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command.

To check the status of a specific container you can use the docker ps command to list all running containers and filter them using grep to show the specific container you're interested in.

Collapse
 
sati1241_119 profile image
Satish

Day -3
What is Kubernetes?

Kubernetes is an open-source container orchestration system for automating software deployment, scaling, and management. Originally designed by Google, the project is now maintained by the Cloud Native Computing Foundation.

Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.

Kubernetes is an open-source container orchestration system for managing, scaling, and automating software deployment. Kubernetes helps organizations with DevOps, as it combines the development and maintenance phase of software systems to improve agility. Through the Kubernetes user interface, developers can view, access, deploy, update, and optimize container ecosystems.

Why Kubernetes?
Kubernetes provides you with a framework to run distributed systems resiliently. It takes care of scaling and failover for your application, provides deployment patterns, and more. For example: Kubernetes can easily manage a canary deployment for your system.

Essentially, containerization is an efficient and effective way to implement DevOps than a monolithic application. Kubernetes creates and manages containers on the cloud-based server systems. Kubernetes helps DevOps teams to reduce the burden of infrastructure by letting containers operate on different machines/environments without breakdowns.

Explained Kubernetes Architecture ?

An environment running Kubernetes consists of the following basic components: a control plane (Kubernetes control plane), a distributed key-value storage system for keeping the cluster state consistent (etcd), and cluster nodes (Kubelets, also called worker nodes or minions).

TABLE OF CONTENTS
Kubernetes Architecture
Control Plane
Worker Node
Kubernetes Control Plane Components

  1. kube-apiserver
  2. etcd
  3. kube-scheduler
  4. Kube Controller Manager
  5. Cloud Controller Manager (CCM) Kubernetes Worker Node Components
  6. Kubelet
  7. Kube proxy
  8. Container Runtime Kubernetes Cluster Addon Components
  9. CNI Plugin

Master Components?
etcd. It stores the configuration information which can be used by each of the nodes in the cluster. ...
API Server. ...
Controller Manager. ...
Scheduler. ...
Docker. ...
Kubelet Service. ...
Kubernetes Proxy Service.

Worker Components?
Worker nodes within the Kubernetes cluster are used to run containerized applications and handle networking to ensure that traffic between applications across the cluster and from outside of the cluster can be properly facilitated.

The components on a node include the kubelet, a container runtime, and the kube-proxy.

Workstation Components?

Kubernetes automates operational tasks of container management and includes built-in commands for deploying applications, rolling out changes to your applications, scaling your applications up and down to fit changing needs, monitoring your applications, and more—making it easier to manage applications.

A Kubernetes cluster consists of the components that are a part of the control plane and a set of machines called nodes.

What is POD?
A pod is the smallest execution unit in Kubernetes. A pod encapsulates one or more applications. Pods are ephemeral by nature, if a pod (or the node it executes on) fails, Kubernetes can automatically create a new replica of that pod to continue operations.

A pod is the smallest execution unit in Kubernetes. A pod encapsulates one or more applications. Pods are ephemeral by nature, if a pod (or the node it executes on) fails, Kubernetes can automatically create a new replica of that pod to continue operations.