what is Docker?
- it is a platform for developing, shipping and running application.
 - it separates your application from your infrastructure for faster building and delivery.
 - these containers are great for Continuous Integration and continuous Delivery i.e. CI/CD workflow.
 
Docker Platform
- Docker provides a way package and run application on loosely isolated environment called containers.
 - Containers are lightweight and contain everything needed for application to run, so that you wont need to rely on what's installed in host.
 
Docker Architecture
- Docker uses the client-sever architecture.
 - It is lightweight, meaning they share the host kernel, not include the full OS, and also have isolated user-space.
 
Docker daemon (dockerd)
- Listens for Docker API and manages docker objects such as images, containers, networks and volumes.
 
Docker Client
- It is the CLI of that used to communicate with the docker daemon process
 - It can use the REST APIs, over UNIX socket or TCP to the daemon
 - When you use commands such as docker run, the client sends these commands to 
dockerd, which carries them out. The docker command uses the Docker API. 
Docker Objects
- When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects.
- Images(blue print) - A ready-made template for creating the docker container. you actually create using other images with your own customization i.e. 
Dockerfile. - Containers(running instance of that blue print) - is a runnable instance of an image. You can create, stop, move or delete a container using docker API or CLI.
 
 - Images(blue print) - A ready-made template for creating the docker container. you actually create using other images with your own customization i.e. 
 
Docker Registries
- It stores a docker images. Docker hub is a public registry that anybody can use.
 
so, here is the basic flow,
 At, first the command is issued via Docker Client(CLI), the client creates a REST API request.
the client communicates with dockerd via UNIX socket or TCP.
daemon checks the local cache.
daemon, sends the request to Docker Registry(docker hub or private registry).
after the request, daemon uses retrieved image to create a writable layer on top of the image for the containers.
it sets up container resources using Docker Objects.
starting the container, the dockerd launches the container as a process on the host OS using the shared kernel.
during the execution of the image, it runs its defined processes.
daemon also tracks lifecycles, resource usage and logs.
response to client is sent back, container ID, logs.
User (CLI)
   ↓
Docker Client → API Request
   ↓
Docker Daemon (Server)
   ↓
Check local image → Pull from Registry if absent
   ↓
Create container using Docker objects
   ↓
Run container (process on host kernel)
   ↓
Return output to Client
Extras : 
Nginx- open-source software that acts as the server, reverse proxy, load balancer and HTTP cache.
Reverse proxy - when a client sends requests to server, basically it does not send to the server directly(maintaining Abstraction), it sends to a middle server(like Nginx | VPN )that decides, which server to send the request(the deciding factor is during developing the Nginx).
Load balancer - distributing the incoming traffic to multiple servers to ensure no single server is overwhelmed.
HTTP caching -  refers to NGINX's ability to store copies of responses from backend servers (origin servers) and serve those cached responses directly to clients for subsequent requests

    
Top comments (0)