mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-11 12:21:17 +00:00
style(docs): standardize heading formats and numbering
- Enforce Level 1-3 structural numbering based on SUMMARY.md hierarchy - Remove structural numbering from Level 4+ headings - Eliminate single child headings by converting to bold text - Auto-inject summary text for headings with multiple children missing intro text - Exclude Appendix chapters from structural numbering - Avoid modifying code block contents - Add script to detect non-standard English usage in headers
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
本节将通过一个简单的 Web 应用例子,带你快速体验 Docker 的核心流程:构建镜像、运行容器。
|
||||
|
||||
### 1。准备代码
|
||||
### 1.1.1 。准备代码
|
||||
|
||||
创建一个名为 `hello-docker` 的文件夹,并在其中创建一个 `index.html` 文件:
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<h1>Hello, Docker!</h1>
|
||||
```
|
||||
|
||||
### 2。编写 Dockerfile
|
||||
### 1.1.2 。编写 Dockerfile
|
||||
|
||||
在同级目录下创建一个名为 `Dockerfile` (无后缀) 的文件:
|
||||
|
||||
@@ -19,7 +19,7 @@ FROM nginx:alpine
|
||||
COPY index.html /usr/share/nginx/html/index.html
|
||||
```
|
||||
|
||||
### 3。构建镜像
|
||||
### 1.1.3 。构建镜像
|
||||
|
||||
打开终端,进入该目录,执行构建命令:
|
||||
|
||||
@@ -31,7 +31,7 @@ $ docker build -t my-hello-world .
|
||||
* `-t my-hello-world`:给镜像起个名字 (标签)
|
||||
* `.`:指定上下文路径为当前目录
|
||||
|
||||
### 4。运行容器
|
||||
### 1.1.4 。运行容器
|
||||
|
||||
使用刚才构建的镜像启动一个容器:
|
||||
|
||||
@@ -43,11 +43,11 @@ $ docker run -d -p 8080:80 my-hello-world
|
||||
* `-d`:后台运行
|
||||
* `-p 8080:80`:将宿主机的 8080 端口映射到容器的 80 端口
|
||||
|
||||
### 5。访问测试
|
||||
### 1.1.5 。访问测试
|
||||
|
||||
打开浏览器访问 [http://localhost:8080](http://localhost:8080),你应该能看到 “Hello,Docker!”。
|
||||
|
||||
### 6。清理
|
||||
### 1.1.6 。清理
|
||||
|
||||
停止并删除容器:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user