mirror of
https://github.com/yeasy/docker_practice.git
synced 2025-08-04 23:02:39 +00:00
Update appendix/repo
This commit is contained in:
@@ -1,28 +1,33 @@
|
||||
## [Nginx](https://hub.docker.com/_/nginx/)
|
||||
## [Nginx](https://store.docker.com/images/nginx/)
|
||||
|
||||
### 基本信息
|
||||
|
||||
[Nginx](https://en.wikipedia.org/wiki/Nginx) 是开源的高效的 Web 服务器实现,支持 HTTP、HTTPS、SMTP、POP3、IMAP 等协议。
|
||||
|
||||
该仓库位于 https://hub.docker.com/_/nginx/ ,提供了 Nginx 1.0 ~ 1.11.x 各个版本的镜像。
|
||||
该仓库位于 https://store.docker.com/images/nginx/ ,提供了 Nginx 1.0 ~ 1.13.x 各个版本的镜像。
|
||||
|
||||
### 使用方法
|
||||
|
||||
下面的命令将作为一个静态页面服务器启动。
|
||||
|
||||
```bash
|
||||
$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx
|
||||
```
|
||||
|
||||
用户也可以不使用这种映射方式,通过利用 Dockerfile 来直接将静态页面内容放到镜像中,内容为
|
||||
|
||||
```bash
|
||||
FROM nginx
|
||||
COPY static-html-directory /usr/share/nginx/html
|
||||
```
|
||||
|
||||
之后生成新的镜像,并启动一个容器。
|
||||
|
||||
```bash
|
||||
$ docker build -t some-content-nginx .
|
||||
$ docker run --name some-nginx -d some-content-nginx
|
||||
```
|
||||
|
||||
开放端口,并映射到本地的 `8080` 端口。
|
||||
|
||||
```bash
|
||||
@@ -34,6 +39,7 @@ Nginx的默认配置文件路径为 `/etc/nginx/nginx.conf`,可以通过映射
|
||||
```bash
|
||||
docker run --name some-nginx -v /some/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
|
||||
```
|
||||
|
||||
使用配置文件时,为了在容器中正常运行,需要保持 `daemon off;`。
|
||||
|
||||
### Dockerfile
|
||||
|
Reference in New Issue
Block a user