---
# System prepended metadata

title: 10 July 2020 - Daily Report
tags: [Daily Report]

---

# 10 July 2020 - Daily Report

# Summary
----
## Expected Outcome : 
* Understand what docker is
* Understand how docker works
___
## Outcome : 
* Understand docker also its architecture and objects.
* Understand how docker objects interact each other

## Further plan:
* Study more about how kubernetes work
* try to install docker

___
## Timeline
1. Study about docker
2. Study about kubernetes

---
# Study Notes
:::info
Reference : 
* Fandi Azam's Notes about Docker. Can be accessed [here](https://hackmd.io/@EHEAmKPKSYmpHcyPeiO8jQ/rkGSGt5HI#What-is-Docker)
:::

## What is Docker?
>Docker is **a tool designed to make its easier to create, make and run applications by using containers.** Containers allow a developer to package up an application with all of the parts it needs such as libararies and other dependencies and deploy it as one package.

## How does docker work?
:::info
Reference : https://docs.docker.com/get-started/overview/#:~:text=Docker%20provides%20the%20ability%20to,simultaneously%20on%20a%20given%20host.&text=You%20can%20even%20run%20Docker,that%20are%20actually%20virtual%20machines!
:::
### Docker Engine
![](https://i.imgur.com/KGfs5fo.png)
Docker engine is a client-server application with three major components:
1. A **server** which is a type of long-running program called a daemon process 
2. A **REST API** which specifies intefaces that programs can use to talk to the daemon and instruct it what to do
3. A **command line interface (CLI) client**
The CLI uses the Docker REST API to control or interact with the docker daemon through scripting or direct CLI commands. many other docker applications use the underlying API and CLI.
The daemon creates and manages Docker objects such as images, containers, networks and volumes. The docker object will be described later.

### Docker Architecture
![](https://i.imgur.com/tKaIGll.png)
Docker uses a client-server architecture. The docker client talks to the Docker daemon which does the heavy lifting of building, running, and distributing the docker containers. The docker client and daemon can run on the same system or we can connect a docker client to a remote docker daemon. The docker client and daemon communicate using a REST API over UNIX sockets or a network interface.

#### The Docker Daemon
The docker daemon ( ```dockerd``` ) **listens** for Docker API requests **and manages** Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemon to manage docker services
#### The Docker client
The Docker client ( ```docker``` ) is **the primary way** that many Docker **users interact with Docker**. When we use commands such as ```docker run```, the client sends these comands to ```dockerd``` which carries them out. The ```docker``` command uses the Docker API. The docker client can communicate with more than one daemon.
#### Docker Registries
A docker *registry* **stores Docker images**. Docker Hub is a public registry that anyone can use and docker is configured to look for images on Docker Hub by default. We can run a private registry.
When we use ```docker pull``` or ```docker run``` commands, the required images are pulled from our configured registry. When we use ```docker push``` command, our image is pushed to our configure registry.

### Docker Objects
#### Images
An image is a **read-only template** with instruction for creating a docker container. But we could also make image that based on another image. For example, using windows image, we can make an image containing windows with certain application installed such as microsoft office or chrome, etc. We can create image of our own or use another images created by others and published in a registry. To build our own image, we can create a dockerfile with a simple syntax for defining the step needed to create the image and run it. Each instruction in a Dockerfile creates a layer in the image. When we change the dockerfile and rebuild the image, only those layers which have changed are rebuilt. This is part of what makes images so lightweight, small, and fast when compared to other virtualization technologies.

#### Container
![](https://i.imgur.com/ehhAWu0.png)
Containers are **an abstraction at the app layer that packages code and other dependencies**. Multiple containers can run on the same machine and share the OS kernel with other containers, each running as isolated processes in user space. Containers take up less space than VMs typically about tens MBs in size. It can handle multiple applications and require fewer CMs and operating systems. Containers can be thought of as necessitating three categories of software:
>* Builder : technology used to build a container
>* Engine : technology used to run a container
>* Orchestration : technology used to manage many containers

##### Containers vs Virtual Machines
:::info
Referring to [johnny's slide](https://drive.google.com/file/d/16u1ePiD053ddtsdWN5bRT7Pg3gpi8HAj/view), the following are the difference between container and VM
:::
![](https://i.imgur.com/fFCLdI1.png)

![](https://i.imgur.com/Rr5gfi6.png)

##### Containers and docker images
![](https://i.imgur.com/qZlHiCG.png)
Containers are runnable instance of an image. We can create, start, stop, move or delete a container using the docker API or CLI. Docker images is an immutable object that can only be read. Meanwhile a container has a writable conatiner layer. This enable read and write on a container. But when the container is deleted, the writable layer is also deleted. The picture above shows multiple containers sharing the same Ubuntu 18.04 image.


## Kubernetes
![](https://i.imgur.com/yOzxOYW.png)

### What is Kubernetes?
:::info
reference : https://www.docker.com/products/kubernetes
:::
>Kubernetes is an **open source orchestration system for automating the management, placement, scaling and routing of containers**. It was developed by Google and contributed to Open Source in 2014 and is now maintained by the Cloud Native Computing Foundation.

### Why do we use Kubernetes?
Kubernetes provides a common framework to run distributed systems so debelopment teams have consistent, immutable infrastructure from development to production for everyu project. Kubernetes can manage scaling requirements, availability, failover, deployment patterns and more.

#### Kubernetes capabilities
* Service and process definition
* Service discovery and load balancing
* Storage orchestration
* Container-level resource management
* Automated deployment and rollback
* Container health management
* Secrets and configuration management

#### Kubernetes Advantages
**Availability**
> Kubernetes clustering has very high fault tolerance built in, allowing for extremely large scale operation

**Auto-Scaling**
> Kubernetes can scale up and scale down based on traffic and server load automatically.

**Extensive Ecosystem**
> Kubernetes has a strong ecosystem around Nontainer Networking Interface(CNI) and Container Storage interface(CSI) and inbuilt logging and monitoring tools.



___


# Conclusion
* Docker is a tool designed to make its easier to create, make and run applications by using containers.
* Docker has an architecture and objects that interact each other. There are two main objects in docker, images and containers. 
* Container is an instance of an image.
* Kubernetes is an open source orchestration system for automating the management, placement, scaling and routing of containers.


###### tags: `Daily Report`