Fix issue#20, format following the guidelines

This commit is contained in:
Baohua Yang
2014-10-14 13:25:01 +08:00
parent 9d26f96ba2
commit cb903202ba
81 changed files with 682 additions and 679 deletions

View File

@@ -1,2 +1,2 @@
# 常见仓库介绍
本章将介绍常见的一些仓库和镜像的功能使用方法和生成它们的Dockerfile等。包括Ubuntu、CentOS、MySQL、MongoDB、Redis、Nginx、Wordpress、Node.js等。
本章将介绍常见的一些仓库和镜像的功能,使用方法和生成它们的 Dockerfile 等。包括 Ubuntu、CentOS、MySQL、MongoDB、Redis、Nginx、Wordpress、Node.js 等。

View File

@@ -1,17 +1,17 @@
## [CentOS](https://registry.hub.docker.com/_/centos/)
### 基本信息
[CentOS](https://en.wikipedia.org/wiki/CentOS)是流行的Linux发行版其软件包大多跟RedHat系列保持一致。
该仓库提供了CentOS从5到7各个版本的镜像。
[CentOS](https://en.wikipedia.org/wiki/CentOS) 是流行的 Linux 发行版,其软件包大多跟 RedHat 系列保持一致。
该仓库提供了 CentOS 从 5 ~ 7 各个版本的镜像。
### 使用方法
默认会启动一个最小化的CentOS环境。
默认会启动一个最小化的 CentOS 环境。
```
$ sudo docker run --name some-centos -i -t centos bash
bash-4.2#
```
### Dockerfile
* [CentOS5版本](https://github.com/CentOS/sig-cloud-instance-images/blob/2e5a9c4e8b7191b393822e4b9e98820db5638a77/docker/Dockerfile)
* [CentOS6版本](https://github.com/CentOS/sig-cloud-instance-images/blob/8717e33ea5432ecb33d7ecefe8452a973715d037/docker/Dockerfile)
* [CentOS7版本](https://github.com/CentOS/sig-cloud-instance-images/blob/af7a1b9f8f30744360a10fe44c53a1591bef26f9/docker/Dockerfile)
* [CentOS 5 版本](https://github.com/CentOS/sig-cloud-instance-images/blob/2e5a9c4e8b7191b393822e4b9e98820db5638a77/docker/Dockerfile)
* [CentOS 6 版本](https://github.com/CentOS/sig-cloud-instance-images/blob/8717e33ea5432ecb33d7ecefe8452a973715d037/docker/Dockerfile)
* [CentOS 7 版本](https://github.com/CentOS/sig-cloud-instance-images/blob/af7a1b9f8f30744360a10fe44c53a1591bef26f9/docker/Dockerfile)

View File

@@ -1,11 +1,11 @@
## [MongoDB](https://registry.hub.docker.com/_/mongo/)
### 基本信息
[MongoDB](https://en.wikipedia.org/wiki/MongoDB)是开源的NoSQL数据库实现。
该仓库提供了MongoDB2.22.7各个版本的镜像。
[MongoDB](https://en.wikipedia.org/wiki/MongoDB) 是开源的 NoSQL 数据库实现。
该仓库提供了 MongoDB 2.2 ~ 2.7 各个版本的镜像。
### 使用方法
默认会在`27017`端口启动数据库。
默认会在 `27017` 端口启动数据库。
```
$ sudo docker run --name some-mongo -d mongo
```
@@ -14,13 +14,13 @@ $ sudo docker run --name some-mongo -d mongo
```
$ sudo docker run --name some-app --link some-mongo:mongo -d application-that-uses-mongo
```
或者通过`mongo`
或者通过 `mongo`
```
$ sudo docker run -it --link some-mongo:mongo --rm mongo sh -c 'exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/test"'
```
### Dockerfile
* [2.2版本](https://github.com/docker-library/mongo/blob/77c841472ccb6cc87fea1218269d097405edc6cb/2.2/Dockerfile)
* [2.4版本](https://github.com/docker-library/mongo/blob/807078cb7b5f0289f6dabf9f6875d5318122bc30/2.4/Dockerfile)
* [2.6版本](https://github.com/docker-library/mongo/blob/77c841472ccb6cc87fea1218269d097405edc6cb/2.6/Dockerfile)
* [2.7版本](https://github.com/docker-library/mongo/blob/807078cb7b5f0289f6dabf9f6875d5318122bc30/2.7/Dockerfile)
* [2.2 版本](https://github.com/docker-library/mongo/blob/77c841472ccb6cc87fea1218269d097405edc6cb/2.2/Dockerfile)
* [2.4 版本](https://github.com/docker-library/mongo/blob/807078cb7b5f0289f6dabf9f6875d5318122bc30/2.4/Dockerfile)
* [2.6 版本](https://github.com/docker-library/mongo/blob/77c841472ccb6cc87fea1218269d097405edc6cb/2.6/Dockerfile)
* [2.7 版本](https://github.com/docker-library/mongo/blob/807078cb7b5f0289f6dabf9f6875d5318122bc30/2.7/Dockerfile)

View File

@@ -1,11 +1,11 @@
## [MySQL](https://registry.hub.docker.com/_/mysql/)
### 基本信息
[MySQL](https://en.wikipedia.org/wiki/MySQL)是开源的关系数据库实现。
该仓库提供了MySQL各个版本的镜像包括5.6系列、5.7系列等。
[MySQL](https://en.wikipedia.org/wiki/MySQL) 是开源的关系数据库实现。
该仓库提供了 MySQL 各个版本的镜像,包括 5.6 系列、5.7 系列等。
### 使用方法
默认会在`3306`端口启动数据库。
默认会在 `3306` 端口启动数据库。
```
$ sudo docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql
```
@@ -13,11 +13,11 @@ $ sudo docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d m
```
$ sudo docker run --name some-app --link some-mysql:mysql -d application-that-uses-mysql
```
或者通过`mysql`
或者通过 `mysql`
```
$ sudo docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
```
### Dockerfile
* [5.6版本](https://github.com/docker-library/mysql/blob/7461a52b43f06839a4d8723ae8841f4cb616b3d0/5.6/Dockerfile)
* [5.7版本](https://github.com/docker-library/mysql/blob/7461a52b43f06839a4d8723ae8841f4cb616b3d0/5.7/Dockerfile)
* [5.6 版本](https://github.com/docker-library/mysql/blob/7461a52b43f06839a4d8723ae8841f4cb616b3d0/5.6/Dockerfile)
* [5.7 版本](https://github.com/docker-library/mysql/blob/7461a52b43f06839a4d8723ae8841f4cb616b3d0/5.7/Dockerfile)

View File

@@ -1,15 +1,15 @@
## [Nginx](https://registry.hub.docker.com/_/nginx/)
### 基本信息
[Nginx](https://en.wikipedia.org/wiki/Nginx)是开源的高效的Web服务器实现支持HTTP、HTTPS、SMTP、POP3、IMAP等协议。
该仓库提供了Nginx1.01.7各个版本的镜像。
[Nginx](https://en.wikipedia.org/wiki/Nginx) 是开源的高效的 Web 服务器实现,支持 HTTP、HTTPS、SMTP、POP3、IMAP 等协议。
该仓库提供了 Nginx 1.0 ~ 1.7 各个版本的镜像。
### 使用方法
下面的命令将作为一个静态页面服务器启动。
```
$ sudo docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx
```
用户也可以不使用这种映射方式通过利用Dockerfile来直接将静态页面内容放到镜像中内容为
用户也可以不使用这种映射方式,通过利用 Dockerfile 来直接将静态页面内容放到镜像中,内容为
```
FROM nginx
COPY static-html-directory /usr/share/nginx/html
@@ -19,16 +19,16 @@ COPY static-html-directory /usr/share/nginx/html
$ sudo docker build -t some-content-nginx .
$ sudo docker run --name some-nginx -d some-content-nginx
```
开放端口,并映射到本地的`8080`端口。
开放端口,并映射到本地的 `8080` 端口。
```
sudo docker run --name some-nginx -d -p 8080:80 some-content-nginx
```
Nginx的默认配置文件路径为`/etc/nginx/nginx.conf`,可以通过映射它来使用本地的配置文件,例如
Nginx的默认配置文件路径为 `/etc/nginx/nginx.conf`,可以通过映射它来使用本地的配置文件,例如
```
docker run --name some-nginx -v /some/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
```
使用配置文件时,为了在容器中正常运行,需要保持`daemon off;`
使用配置文件时,为了在容器中正常运行,需要保持 `daemon off;`
### Dockerfile
* [11.7版本](https://github.com/nginxinc/docker-nginx/blob/3713a0157083eb4776e71f5a5aef4b2a5bc03ab1/Dockerfile)
* [1 ~ 1.7 版本](https://github.com/nginxinc/docker-nginx/blob/3713a0157083eb4776e71f5a5aef4b2a5bc03ab1/Dockerfile)

View File

@@ -1,11 +1,11 @@
## [Node.js](https://registry.hub.docker.com/_/node/)
### 基本信息
[Node.js](https://en.wikipedia.org/wiki/Node.js)是基于JavaScript的可扩展服务端和网络软件开发平台。
该仓库提供了Node.js0.80.11各个版本的镜像。
[Node.js](https://en.wikipedia.org/wiki/Node.js)是基于 JavaScript 的可扩展服务端和网络软件开发平台。
该仓库提供了 Node.js 0.8 ~ 0.11 各个版本的镜像。
### 使用方法
在项目中创建一个Dockerfile。
在项目中创建一个 Dockerfile。
```
FROM node:0.10-onbuild
# replace this with your application's default port
@@ -23,6 +23,6 @@ $ sudo docker run -it --rm --name my-running-script -v "$(pwd)":/usr/src/myapp -
```
### Dockerfile
* [0.8版本](https://github.com/docker-library/node/blob/d017d679e92e84a810c580cdb29fcdbba23c2bb9/0.8/Dockerfile)
* [0.10版本](https://github.com/docker-library/node/blob/913a225f2fda34d6a811fac1466e4f09f075fcf6/0.10/Dockerfile)
* [0.11版本](https://github.com/docker-library/node/blob/d017d679e92e84a810c580cdb29fcdbba23c2bb9/0.11/Dockerfile)
* [0.8 版本](https://github.com/docker-library/node/blob/d017d679e92e84a810c580cdb29fcdbba23c2bb9/0.8/Dockerfile)
* [0.10 版本](https://github.com/docker-library/node/blob/913a225f2fda34d6a811fac1466e4f09f075fcf6/0.10/Dockerfile)
* [0.11 版本](https://github.com/docker-library/node/blob/d017d679e92e84a810c580cdb29fcdbba23c2bb9/0.11/Dockerfile)

View File

@@ -1,29 +1,29 @@
## [Redis](https://registry.hub.docker.com/_/redis/)
### 基本信息
[Redis](https://en.wikipedia.org/wiki/Redis)是开源的内存Key-Value数据库实现。
该仓库提供了Redis2.62.8.9各个版本的镜像。
[Redis](https://en.wikipedia.org/wiki/Redis) 是开源的内存 Key-Value 数据库实现。
该仓库提供了 Redis 2.6 ~ 2.8.9 各个版本的镜像。
### 使用方法
默认会在`6379`端口启动数据库。
默认会在 `6379` 端口启动数据库。
```
$ sudo docker run --name some-redis -d redis
```
另外还可以启用[持久存储](http://redis.io/topics/persistence)。
另外还可以启用 [持久存储](http://redis.io/topics/persistence)。
```
$ sudo docker run --name some-redis -d redis redis-server --appendonly yes
```
默认数据存储位置在`VOLUME/data`。可以使用`--volumes-from some-volume-container``-v /docker/host/dir:/data`将数据存放到本地。
默认数据存储位置在 `VOLUME/data`。可以使用 `--volumes-from some-volume-container``-v /docker/host/dir:/data` 将数据存放到本地。
使用其他应用连接到容器,可以用
```
$ sudo docker run --name some-app --link some-redis:redis -d application-that-uses-redis
```
或者通过`redis-cli`
或者通过 `redis-cli`
```
$ sudo docker run -it --link some-redis:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'
```
### Dockerfile
* [2.6版本](https://github.com/docker-library/redis/blob/02d9cd887a4e0d50db4bb085eab7235115a6fe4a/2.6.17/Dockerfile)
* [最新2.8版本](https://github.com/docker-library/redis/blob/d0665bb1bbddd4cc035dbc1fc774695fa534d648/2.8.13/Dockerfile)
* [2.6 版本](https://github.com/docker-library/redis/blob/02d9cd887a4e0d50db4bb085eab7235115a6fe4a/2.6.17/Dockerfile)
* [最新 2.8 版本](https://github.com/docker-library/redis/blob/d0665bb1bbddd4cc035dbc1fc774695fa534d648/2.8.13/Dockerfile)

View File

@@ -1,17 +1,17 @@
## [Ubuntu](https://registry.hub.docker.com/_/ubuntu/)
### 基本信息
[Ubuntu](https://en.wikipedia.org/wiki/Ubuntu)是流行的Linux发行版其自带软件版本往往较新一些。
该仓库提供了Ubuntu从12.0414.10各个版本的镜像。
[Ubuntu](https://en.wikipedia.org/wiki/Ubuntu) 是流行的 Linux 发行版,其自带软件版本往往较新一些。
该仓库提供了 Ubuntu从12.04 ~ 14.10 各个版本的镜像。
### 使用方法
默认会启动一个最小化的Ubuntu环境。
默认会启动一个最小化的 Ubuntu 环境。
```
$ sudo docker run --name some-ubuntu -i -t ubuntu
root@523c70904d54:/#
```
### Dockerfile
* [12.04版本](https://github.com/tianon/docker-brew-ubuntu-core/blob/2b105575647a7e2030ff344d427c3920b89e17a9/precise/Dockerfile)
* [14.04版本](https://github.com/tianon/docker-brew-ubuntu-core/blob/2b105575647a7e2030ff344d427c3920b89e17a9/trusty/Dockerfile)
* [14.10版本](https://github.com/tianon/docker-brew-ubuntu-core/blob/2b105575647a7e2030ff344d427c3920b89e17a9/utopic/Dockerfile)
* [12.04 版本](https://github.com/tianon/docker-brew-ubuntu-core/blob/2b105575647a7e2030ff344d427c3920b89e17a9/precise/Dockerfile)
* [14.04 版本](https://github.com/tianon/docker-brew-ubuntu-core/blob/2b105575647a7e2030ff344d427c3920b89e17a9/trusty/Dockerfile)
* [14.10 版本](https://github.com/tianon/docker-brew-ubuntu-core/blob/2b105575647a7e2030ff344d427c3920b89e17a9/utopic/Dockerfile)

View File

@@ -1,19 +1,19 @@
## [WordPress](https://registry.hub.docker.com/_/wordpress/)
### 基本信息
[WordPress](https://en.wikipedia.org/wiki/WordPress)是开源的Blog和内容管理系统框架它基于PhPMySQL。
该仓库提供了WordPress 4.0版本的镜像。
[WordPress](https://en.wikipedia.org/wiki/WordPress) 是开源的 Blog 和内容管理系统框架,它基于 PhPMySQL。
该仓库提供了 WordPress 4.0 版本的镜像。
### 使用方法
启动容器需要MySQL的支持默认端口为`80`
启动容器需要 MySQL 的支持,默认端口为 `80`
```
$ sudo docker run --name some-wordpress --link some-mysql:mysql -d wordpress
```
启动WordPress容器时可以指定的一些环境参数包括
* `-e WORDPRESS_DB_USER=...` 缺省为“root”
* `-e WORDPRESS_DB_PASSWORD=...` 缺省为连接mysql容器的环境变量`MYSQL_ROOT_PASSWORD`的值
* `-e WORDPRESS_DB_NAME=...` 缺省为“wordpress”
* `-e WORDPRESS_AUTH_KEY=...`, `-e WORDPRESS_SECURE_AUTH_KEY=...`, `-e WORDPRESS_LOGGED_IN_KEY=...`, `-e WORDPRESS_NONCE_KEY=...`, `-e WORDPRESS_AUTH_SALT=...`, `-e WORDPRESS_SECURE_AUTH_SALT=...`, `-e WORDPRESS_LOGGED_IN_SALT=...`, `-e WORDPRESS_NONCE_SALT=...` 缺省为随机sha1串
启动 WordPress 容器时可以指定的一些环境参数包括
* `-e WORDPRESS_DB_USER=...` 缺省为 “root”
* `-e WORDPRESS_DB_PASSWORD=...` 缺省为连接 mysql 容器的环境变量 `MYSQL_ROOT_PASSWORD` 的值
* `-e WORDPRESS_DB_NAME=...` 缺省为 “wordpress”
* `-e WORDPRESS_AUTH_KEY=...`, `-e WORDPRESS_SECURE_AUTH_KEY=...`, `-e WORDPRESS_LOGGED_IN_KEY=...`, `-e WORDPRESS_NONCE_KEY=...`, `-e WORDPRESS_AUTH_SALT=...`, `-e WORDPRESS_SECURE_AUTH_SALT=...`, `-e WORDPRESS_LOGGED_IN_SALT=...`, `-e WORDPRESS_NONCE_SALT=...` 缺省为随机 sha1
### Dockerfile
* [4.0版本](https://github.com/docker-library/wordpress/blob/aee00669e7c43f435f021cb02871bffd63d5677a/Dockerfile)
* [4.0 版本](https://github.com/docker-library/wordpress/blob/aee00669e7c43f435f021cb02871bffd63d5677a/Dockerfile)