Vault 资讯瀑布媒体2026.07.11 23:30 UTC+8

EP221:Docker 底层工作原理

Docker底层原理详解:容器启动的CLI→dockerd→containerd→runc流程及命名空间/cgroups隔离;另对比git merge/rebase,并介绍向量数据库等主题。

可链式计算。即刻入队。(赞助)

使用 Render 的轻量级 SDK 定义任务,并将它们链接成长期运行的分布式工作流。按需启动您的智能体和批处理作业。Render Workflows 负责排队、编排和重试。

使用代码 BYTE 获得 50 美元积分。

本周系统设计回顾:

- Docker 底层工作原理

- git merge 与 git rebase

- 12 个流行的向量数据库帮助您为模型提供正确的上下文

- 大型系统的分页策略

- LLM 如何使用具有深度研究的 AI 智能体

Docker 底层工作原理

Docker 容器从一个简单命令开始,但该命令必须被转换为一个正在运行的 Linux 进程。以下是实际发生的过程。

Docker CLI 接收你的命令,并将其作为 API 调用发送到主机上运行的 Docker 守护进程(dockerd)。

dockerd 会检查 nginx 镜像是否已存在于磁盘上。如果没有,它会从 Docker Hub 或 ECR 等注册中心拉取。然后准备容器配置。

dockerd 不会直接启动容器。它将请求传递给负责管理容器生命周期的 containerd。containerd 准备运行时文件,并组装一个由 OCI 配置和根文件系统组成的 bundle。

containerd 随后调用 runc。runc 读取 bundle,创建配置中定义的 Linux 命名空间和挂载,并在其中启动进程。进程运行后,runc 退出。

运行中的容器是一个普通的 Linux 进程,拥有自己的 PID、网络和挂载命名空间。其文件系统由只读镜像层堆叠而成,顶部有一个可写层,因此容器内的更改不会修改镜像。

隔离来自内核特性。命名空间分离进程,cgroups 限制 CPU 和内存,网络命名空间为容器提供自己的接口。没有客户操作系统,也没有虚拟机监控程序。

由你决定:你的容器问题大多出现在哪里,是镜像、网络,还是资源限制?

git merge 与 git rebase

这两个命令都能将你的更改合并到 main 分支。区别在于它们对历史记录做了什么。

git merge 保留原始分支结构。如果 main 和 feature 分支已经分叉,Git 会创建一个合并提交,并保留两条开发线。这样可以很容易地看到工作在哪里分支、合并了什么、以及何时重新汇合。

git rebase 采用不同的方法。它将你的 feature 提交作为新提交重新应用到最新的 main 分支上。结果是线性的历史记录。但这些被 rebase 的提交会获得新的 ID,因此 rebase 共享分支通常意味着强制推送,并让其他人同步到被重写的历史。

这就是为什么团队通常在共享分支上使用 merge。它保持现有提交 ID 不变,因此每个人都可以拉取而无需处理冲突。Rebase 对于在合并之前清理自己的分支更有用。

由你决定:你更喜欢哪个命令?

12 个流行的向量数据库帮助您为模型提供正确的上下文

EP221: How Docker Works Under the Hood

Chainable compute. Right on queue. (Sponsored)

Define tasks with Render’s lightweight SDK and chain them into long-running, distributed workflows. Launch your agents and batch jobs on demand. Render Workflows handles queuing, orchestration, and retries.

Get $50 credits with code BYTE

This week’s system design refresher:

- How Docker Works Under the Hood

- git merge vs git rebase

- 12 popular vector databases help you get the right context to the model

- Pagination Strategies for Large Systems

- How LLMs Use AI Agents with Deep Research

How Docker Works Under the Hood

A Docker container starts with a single command, but that command has to be turned into a running Linux process. Here is what actually happens.

The Docker CLI takes your command and sends it as an API call to the Docker daemon (dockerd) running on the host.

dockerd checks whether the nginx image is already on disk. If it is not, it pulls it from a registry like Docker Hub or ECR. Then it prepares the container config.

dockerd does not start the container directly. It passes the request to containerd, which manages the container lifecycle. containerd prepares the runtime files and assembles a bundle made of the OCI config and the root filesystem.

containerd then calls runc. runc reads the bundle, creates the Linux namespaces and mounts defined in the config, and starts the process inside them. Once the process is running, runc exits.

The running container is a regular Linux process with its own PID, network, and mount namespaces. Its filesystem is a stack of read-only image layers with a writable layer on top, so changes inside the container do not modify the image.

Isolation comes from kernel features. Namespaces separate processes, cgroups limit CPU and memory, and network namespaces give the container its own interfaces. There is no guest OS and no hypervisor.

Over to you: where do most of your container issues show up, the image, networking, or resource limits?

git merge vs git rebase

Both commands get your changes into main. The difference is what they do to history.

git merge preserves the original branch structure. If main and feature branches have diverged, Git creates a merge commit and keeps both lines of development . That makes it easy to see where work branched off, what got merged, and when it came back together.

git rebase takes a different approach. It reapplies your feature commits onto the latest main branch as new commits. The result is a linear history. But those rebased commits get new IDs, so rebasing a shared branch usually means force-pushing and making others sync to rewritten history.

That is why teams often use merge on shared branches. It keeps existing commit IDs unchanged, so everyone can pull without dealing with conflicts. Rebase is more useful for cleaning up your own branch before you merge it.

Over to you: which command do you prefer?

12 popular vector databases help you get the right context to the model

- Pinecone: Fully managed, serverless with hybrid search (dense + sparse) native. Best when your team wants zero infrastructure overhead.

- Weaviate: Built-in vectorization and native BM25 + vector hybrid search. Best when you need keyword and semantic search in one system.

- Milvus: Distributed vector database with horizontal scaling and GPU acceleration support. Best for massive-scale workloads.

- Qdrant: Rust-based vector search engine with dense, sparse, and metadata filtering built for production-grade retrieval. Best when control over ranking and latency matters.

- Chroma: Embedded vector database that runs directly inside Python applications. Best for local RAG prototypes and experimentation.

- Pgvector: Postgres extension that adds vector search using SQL. Supports HNSW and IVF indexes. Best if you're already running PostgreSQL.

- FAISS: Meta's ANN library for vector similarity search. GPU accelerated and highly customizable. Best for custom retrieval systems.

- Vespa: Combines dense vectors, sparse retrieval, and structured data in one engine. Best for large-scale search and ranking systems.

- MongoDB Atlas Vector Search: Vector search integrated directly into MongoDB collections. Best if your application already uses MongoDB.

- Redis Vector: Low-latency vector search alongside caching, pub/sub, and streaming. Best for real-time AI applications and semantic caching.

- Elasticsearch: Combines BM25 and vector search in a single query engine. Best if you're already running Elastic for search and analytics.

- LanceDB: Runs in-process, zero-copy disk reads, no server to manage. Native multimodal support. Best for local-first AI, edge deployments, and data lake workloads.

The right choice depends on your use case and in production, it's common to use more than one. Which of these tools are you using in production?

Pagination Strategies for Large Systems

Pagination looks simple when your table has a few thousand rows. It becomes a real problem once your data grows.

Here is how the main approaches compare when the dataset is large.

Most pagination implementations start with offset and page numbers. You ask for “?page=3&size=10” and the database skips 20 rows, then returns 10. Simple to build and easy to explain. The issue is that the database still reads every row it skips. Page 5 is fast. Page 5000 is slow.

Keyset pagination handles deep pages much better. Instead of counting rows, you tell the server to return items after ID 101. The query goes straight to that point using the index, so page 1 and page 10,000 take the same time.

Continuation tokens are common in large APIs like S3 and YouTube. The server returns a token, you send it back on the next request, and it resumes from where the last response ended. It hides the cursor logic from the client. The token is tied to the filters and sort order from the original request, so the client must keep using the same parameters until the pagination ends.

Time-based pagination works well for feeds and logs. You ask for items before a timestamp and read backwards. Add a secondary field, like an ID, for rows that share the same timestamp. Without it, you can lose records.

Over to you: Which one have you used?

How LLMs Use AI Agents with Deep Research

When you ask an LLM such as Claude, ChatGPT, or Gemini to do deep research on a complex topic, it’s not just one model doing all the work. It’s a coordinated system of specialized AI agents.

Here’s how it works:

Step 1: Understanding The Question and Making a Plan

It all starts with the query, something like “Analyze the competitive landscape of AI agents in 2026. The system doesn’t just dive in blindly. First, it may ask clarifying questions to understand exactly what is needed. Then, it generates a plan and breaks the big question down into smaller and manageable tasks.

Step 2: Sub-Agents Get to Work

Each small task gets assigned to a sub-agent, which is basically a mini AI worker with a specific job. For example, one sub-agent might be tasked with finding the latest Nvidia earnings. It figures out which tools to use, such as searching the web, browsing a specific page, or even run code to analyze data. All of this happens through a secure layer of APIs and services that connect the AI to the outside world.

Step 3: Putting it All Together

Once all the sub-agents finish their tasks, a Synthesizer Agent takes over. It aggregates everything, identifies key themes, plans an outline, and removes any redundant or duplicate information. At the same time, a Citation Agent makes sure every claim is linked back to its source and properly formatted. The end result is a polished, well-cited final output ready for use.

Over to you: Have you tried deep research in any LLM?

查看原始发布