Add blank lines around headers

This commit is contained in:
yeasy
2026-03-24 09:27:04 -07:00
parent 857e3b73f6
commit ae8636e96f
112 changed files with 468 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ EXPOSE 80 443
$ docker inspect nginx --format '{{.Config.ExposedPorts}}'
map[80/tcp:{}]
```
#### 2. 配合 -P 使用
使用 `docker run -P` Docker 会自动映射 EXPOSE 的端口到宿主机随机端口
@@ -75,6 +76,7 @@ flowchart TD
Run["docker run -p<br/>实际端口映射<br/>宿主机 ←→ 容器"]
Expose ~~~ Run
```
#### 没有 EXPOSE 也能 -p
```docker
@@ -145,6 +147,7 @@ EXPOSE 5432
FROM redis
EXPOSE 6379
```
#### 2. 使用明确的协议
```docker
@@ -160,6 +163,7 @@ EXPOSE 53/udp
EXPOSE 53/tcp 53/udp
```
#### 3. 与应用实际端口保持一致
```docker