Remove blank lines after code block markers

This commit is contained in:
yeasy
2026-03-21 22:36:09 -07:00
parent 312f8fea42
commit 9ac19d79ee
132 changed files with 0 additions and 1517 deletions

View File

@@ -21,7 +21,6 @@ flowchart TD
ContainerFS --> UnionFS
UnionFS --> ContainerLayer --> ImageLayer3 --> ImageLayer2 --> ImageLayer1
```
---
### 12.4.2 为什么 Docker 使用联合文件系统
@@ -35,7 +34,6 @@ flowchart TD
Nginx["nginx:alpine"] --> Alpine["alpine:3.19 (共享基础层)"]
MyApp["myapp:latest"] --> Alpine
```
多个镜像共享相同的底层节省磁盘空间
#### 2. 快速构建
@@ -48,7 +46,6 @@ COPY package.json ./ # 层2依赖定义
RUN npm install # 层3安装依赖
COPY . . # 层4应用代码
```
代码变化时只需重建层 4 1-3 使用缓存
#### 3. 容器启动快
@@ -80,7 +77,6 @@ flowchart LR
B_C --- B_I
A_C --- A_I
```
**流程**
1. 从只读层读取文件
@@ -112,7 +108,6 @@ Docker 的存储驱动经历了从早期各式各样的机制(如 aufs, device
#### 查看当前存储驱动与后端
```bash
## 查看默认存储驱动 (Storage Driver)
$ docker info | grep "Storage Driver"
Storage Driver: overlay2
@@ -121,7 +116,6 @@ Storage Driver: overlay2
$ docker info | grep "containerd image store"
containerd image store: true
```
---
### 12.4.5 overlay2 工作原理
@@ -142,7 +136,6 @@ flowchart TD
OverlayFS --> Lower2
OverlayFS --> Lower1
```
- **lowerdir**只读的镜像层 (可以有多个)
- **upperdir**可写的容器层
- **workdir**OverlayFS 的工作目录
@@ -162,7 +155,6 @@ flowchart TD
### 12.4.6 查看镜像层
```bash
## 查看镜像的层信息
$ docker history nginx:alpine
@@ -184,7 +176,6 @@ $ docker inspect nginx:alpine --format '{{json .GraphDriver.Data}}' | jq
"WorkDir": "/var/lib/docker/overlay2/.../work"
}
```
---
### 12.4.7 最佳实践
@@ -194,7 +185,6 @@ $ docker inspect nginx:alpine --format '{{json .GraphDriver.Data}}' | jq
#### 1. 减少镜像层数
```docker
## ❌ 每条命令创建一层
RUN apt-get update
@@ -207,7 +197,6 @@ RUN apt-get update && \
apt-get install -y nginx && \
rm -rf /var/lib/apt/lists/*
```
#### 2. 避免在容器中写入大量数据
容器层的写入性能低于直接写入大量数据应使用