docker_practice/appendix/repo/nginx.md

49 lines
1.3 KiB
Go
Raw Normal View History

2018-12-14 19:08:14 +08:00
## [Nginx](https://hub.docker.com/_/nginx/)
2016-12-10 17:00:25 +08:00
###
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
[Nginx](https://en.wikipedia.org/wiki/Nginx) 是开源的高效的 Web 服务器实现,支持 HTTP、HTTPS、SMTP、POP3、IMAP 等协议。
`https://hub.docker.com/_/nginx/` Nginx 1.0 ~ 1.17.x
2016-12-10 17:00:25 +08:00
### 使
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
2017-11-22 11:13:23 +08:00
```bash
2016-12-10 17:00:25 +08:00
$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx
```
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
使 Dockerfile
2017-11-22 11:13:23 +08:00
```bash
2016-12-10 17:00:25 +08:00
FROM nginx
COPY static-html-directory /usr/share/nginx/html
```
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
2017-11-22 11:13:23 +08:00
```bash
2016-12-10 17:00:25 +08:00
$ docker build -t some-content-nginx .
$ docker run --name some-nginx -d some-content-nginx
```
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
`8080`
2017-11-22 11:13:23 +08:00
```bash
2017-12-01 17:32:39 +08:00
$ docker run --name some-nginx -d -p 8080:80 some-content-nginx
2016-12-10 17:00:25 +08:00
```
Nginx `/etc/nginx/nginx.conf`使
2017-11-22 11:13:23 +08:00
```bash
2017-12-01 17:32:39 +08:00
$ docker run -d \
--name some-nginx \
-v /some/nginx.conf:/etc/nginx/nginx.conf:ro \
nginx
2016-12-10 17:00:25 +08:00
```
2017-11-24 10:19:15 +08:00
2016-12-10 17:00:25 +08:00
### Dockerfile
2017-11-01 00:36:57 +08:00
https://github.com/docker-library/docs/tree/master/nginx 查看。