mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-26 11:45:33 +00:00
Remove blank lines after code block markers
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
```html
|
||||
<h1>Hello, Docker!</h1>
|
||||
```
|
||||
|
||||
### 1.1.2 编写 Dockerfile
|
||||
|
||||
在同级目录下创建一个名为 `Dockerfile` (无后缀) 的文件:
|
||||
@@ -18,7 +17,6 @@
|
||||
FROM nginx:alpine
|
||||
COPY index.html /usr/share/nginx/html/index.html
|
||||
```
|
||||
|
||||
### 1.1.3 构建镜像
|
||||
|
||||
打开终端,进入该目录,执行构建命令:
|
||||
@@ -26,7 +24,6 @@ COPY index.html /usr/share/nginx/html/index.html
|
||||
```bash
|
||||
$ docker build -t my-hello-world .
|
||||
```
|
||||
|
||||
* `docker build`:构建命令
|
||||
* `-t my-hello-world`:给镜像起个名字 (标签)
|
||||
* `.`:指定上下文路径为当前目录
|
||||
@@ -38,7 +35,6 @@ $ docker build -t my-hello-world .
|
||||
```bash
|
||||
$ docker run -d -p 8080:80 my-hello-world
|
||||
```
|
||||
|
||||
* `docker run`:运行命令
|
||||
* `-d`:后台运行
|
||||
* `-p 8080:80`:将宿主机的 8080 端口映射到容器的 80 端口
|
||||
@@ -52,7 +48,6 @@ $ docker run -d -p 8080:80 my-hello-world
|
||||
停止并删除容器:
|
||||
|
||||
```bash
|
||||
|
||||
## 查看正在运行的容器 ID
|
||||
|
||||
$ docker ps
|
||||
@@ -65,5 +60,4 @@ $ docker stop <CONTAINER_ID>
|
||||
|
||||
$ docker rm <CONTAINER_ID>
|
||||
```
|
||||
|
||||
恭喜!你已经完成了第一次 Docker 实战。接下来请阅读 [Docker 核心概念](../02_basic_concept/README.md)做深入了解。
|
||||
|
||||
Reference in New Issue
Block a user