Launching 40 Days of Kubernetes: First Day Insights ๐
Fundamentals of containers and Docker:
Before diving into Kubernetes, let's understand containers and how they work! ๐ณ
1. Why do we need containers? ๐ค
In traditional development, applications may work locally but fail in testing or production due to:
Configuration mismatches
Library and package differences
Code dependency conflicts
Containers solve this by packaging the app code with all its dependencies, ensuring consistent runs across environments.
2. What is a container? ๐ฆโจ
A container is a lightweight, portable package that includes:
Application code
System dependencies
Application libraries
As long as Docker is installed, the container can run on any OS.
3. What containers bring to the table? ๐
Effective resource management ๐ผ
Cost savings ๐ฐ
Reduced manual efforts ๐ ๏ธ
Consistent across different environments(Dev,staging,prod)
Isolated environment for applications (base image)
4. What is Docker? ๐ณ
Docker is a platform that implements containerization and helps to build , run and ship the container. It effectively manages the container lifecycle.
5. VMs vs. Containers
Virtual Machines (VMs):
Virtualize the OS layer
Provide complete isolation and enhanced security(Guest OS)
Typically large in size (GBs)
Containers:
Virtualize the application layer
Offer portability and effective resource utilization
Share host OS resources, ensuring cost savings and isolation through base images
6. Container Shared Resources ๐ค
Containers share these from the host OS:
Filesystem: Shared file system
Namespace: Isolates running container processes
System Calls: Host OS kernel handles system calls from containers
CGroups: Limits and controls CPU and RAM usage for containers
Networking: Facilitates container networking
7. Docker Workflow ๐
Key components:
Dockerfile: Blueprint for building Docker image.
Docker image: Read-only template ready to run as a container.
Docker registry: Stores all the images.
8. Docker Commands
docker build
: Build a Docker image.docker run
: Run a container from an image.docker push
: Push an image to a Docker registry.docker pull
: Pull an image from a Docker registry.
9. Docker Architecture ๐๏ธ
The flow:
Docker client interacts with Docker host.
Docker daemon(on Docker host) receives requests from Docker client and manages images, volumes, networks, and containers.
Docker registry stores built images, ready for shipment to any environment.
When the Docker Daemon (dockerd) receives a build request from the client, it interacts with the container runtime to build the image based on the Dockerfile. Once built, the image can be pushed to a Docker registry if needed.
10. Image vs Container?
Image: Image is the actual package we built using Dockerfile, it's a read-only format.
Container: Running environment of our image is container.
Stay tuned for more updates as we progress through the #40DaysOfK8s challenge! Happy learning, keep sharing! ๐๐ก