Why Docker and Kubernetes Are Revolutionizing Cloud‑Native Development
This article explains Docker’s lightweight container engine, its goals, core concepts such as images, containers, and repositories, compares containers to virtual machines, introduces Dockerfile, cgroups, Docker Compose, Docker Machine, and provides an overview of Kubernetes architecture and components, highlighting their role in cloud‑native environments.
Introduction
Docker is an open‑source engine that creates lightweight, portable, self‑contained containers for any application. Containers built on a laptop can be deployed in VMs, bare metal, OpenStack, and other platforms.
Docker Goals
Provide a lightweight and simple modeling method.
Separate responsibilities logically.
Enable a fast and efficient development lifecycle.
Encourage a service‑oriented architecture where one container runs one application.
Docker runs as a process on the host, using namespaces for isolation, cgroups for resource limits, and copy‑on‑write for efficient file operations.
cgroups
cgroups are a Linux kernel mechanism that groups tasks to apply resource limits, accounting, prioritization, and control, forming the foundation for container virtualization.
Docker vs Virtual Machines
The Docker daemon communicates with the host OS to allocate resources and isolate containers. Containers start in milliseconds, saving disk space compared to VMs, which take minutes to boot. VMs are still useful for full isolation in multi‑tenant cloud environments.
Docker Basics
Core Concepts
Image
Container
Repository
Slogans
Build, Ship and Run Build once, Run anywhere
Dockerfile
A Dockerfile is a source file that defines the instructions to build an image.
FROM tomcat
MAINTAINER [email protected]
RUN rm -rf /usr/local/tomcat/webapps/*
COPY jhjkhkj.zip /usr/local/tomcat/webapps
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezoneImage Layers
Images consist of multiple stacked layers; each RUN command adds a new layer. Example using docker image inspect nginx:latest shows six layers.
% docker image inspect nginx:latest
[
{
"Id": "sha256:...",
"RepoTags": ["nginx:latest"],
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:2edcec...",
"sha256:e379e8...",
"sha256:b8d6e6...",
"sha256:f1db22...",
"sha256:32ce5f...",
"sha256:d874fd..."
]
}
}
]Basic Docker Commands
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mytest latest 26d746eb2c68 26 hours ago 680MB
nginx latest 605c77e624dd 13 days ago 141MB
tomcat latest fb5657adc892 2 weeks ago 680MB
docker/getting-started latest 26d80cd96d69 5 weeks ago 28.5MB
% docker run -d -p 91:80 nginx
...container id...
% docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
...output...Docker Compose & Docker Machine
Docker Compose
Compose defines multi‑container applications in a YAML file and starts them with a single command.
version: '3'
services:
mysql:
image: daocloud.io/yjmyzz/mysql-osx:latest
volumes:
- ./mysql/db:/var/lib/mysql
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=123456
service1:
image: java:latest
volumes:
- ./java:/opt/app
expose:
- "8080"
links:
- mysql:default
command: java -jar /opt/app/spring-boot-rest-framework-1.0.0.jar
service2:
image: java:latest
volumes:
- ./java:/opt/app
expose:
- "8080"
links:
- mysql:default
command: java -jar /opt/app/spring-boot-rest-framework-1.0.0.jar
nginx1:
image: nginx:latest
volumes:
- ./nginx/html:/usr/share/nginx/html:ro
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
ports:
- "80:80"
links:
- service1:service1
- service2:service2Docker Machine
Docker Machine configures and manages Docker‑enabled hosts, installing the Docker Engine on local virtual machines or remote cloud providers.
Cloud Native
Cloud native means designing applications to run in cloud environments, leveraging elasticity and distributed advantages. It combines micro‑services, DevOps, continuous delivery, and containerization.
Kubernetes (K8s)
Name Origin
K8s is a shorthand where “k” is followed by eight letters and then “s”.
Key Features
Portability across public, private, hybrid, and multi‑cloud environments.
Extensibility via modular plugins.
Automation of deployment, restart, replication, and scaling.
Architecture & Components
etcd – distributed key‑value store.
flannel – cross‑host container networking.
kube‑apiserver – API server.
kube‑controller‑manager – ensures desired state.
kube‑scheduler – schedules containers to nodes.
kubelet – runs containers on nodes.
kube‑proxy – network proxy.
A pod is the smallest scheduling unit, containing one or more containers that share a namespace and can communicate via localhost.
Private Cloud Architecture
Future articles will dive deeper into K8s practice and component analysis.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
JD Cloud Developers
JD Cloud Developers (Developer of JD Technology) is a JD Technology Group platform offering technical sharing and communication for AI, cloud computing, IoT and related developers. It publishes JD product technical information, industry content, and tech event news. Embrace technology and partner with developers to envision the future.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
