461 Commits
v0.1 ... v0.8

Author SHA1 Message Date
Baohua Yang
b0bde1341c release 0.8.0 2017-01-08 22:48:29 +08:00
Baohua Yang
0b23cf591c Merge pull request #146 from JohannLai/master
Fix “Web” to "web",consistent with sub directories
2017-01-06 22:43:35 +08:00
johannlai
93e2d43c4f 修改Web为web,与目录中的命名一致 2017-01-06 15:44:31 +08:00
Baohua Yang
6448a627f6 Fix figure path 2016-12-20 15:47:31 +08:00
Baohua Yang
67fe62b449 Update version number 2016-12-20 15:46:42 +08:00
yeasy
4911fba3e0 Track 2 files into repository.
- untracked _images/docker_primer.png
- removed docker_primer.png

Auto commit by GitBook Editor
2016-12-20 07:26:13 +00:00
yeasy
8e3748cd8d Updates Compose usage 2016-12-20 15:35:52 +08:00
Baohua Yang
54c0f43f19 Merge pull request #145 from twang2218/install-mac
Add Homebrew Cask install method to install/mac.md
2016-12-20 09:56:09 +08:00
Baohua Yang
3d66f42043 Merge pull request #144 from hzwangsiyu/master
Fix typo
2016-12-20 09:55:18 +08:00
Tao Wang
1962354f5f Add Homebrew Cask install method to install/mac.md
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-12-20 12:03:56 +11:00
hzwangsiyu
29c0385b12 fix typo 2016-12-20 00:57:27 +08:00
Baohua Yang
a46012033f Merge pull request #141 from xiaoxing598/master
Change term of "internal"
2016-12-15 16:44:50 +08:00
Baohua Yang
ecc493ac96 Merge pull request #140 from chenshenyou/master
Fix issue #139: fix typo, change from 意外 to 以外
2016-12-15 16:44:01 +08:00
Allen
b1cf8d3dc1 修复错误描述 2016-12-15 09:42:50 +08:00
chenshenyou
63d52eba72 Fix issue #139: fix typo, change from 意外 to 以外 2016-12-14 23:12:58 +08:00
Baohua Yang
f2ede78953 Add new QQ group 2016-12-12 10:39:13 +08:00
Baohua Yang
2cfa980930 Add faq to find network veth pair 2016-12-10 17:06:04 +08:00
Baohua Yang
36ab0b9862 Update appendix section 2016-12-10 17:00:25 +08:00
Baohua Yang
f2d6f998ab Move image mirror introcution to the installation chapter
Fix issue #136.
2016-11-28 11:33:23 +08:00
Baohua Yang
e537012881 Merge pull request #137 from twang2218/update-dockerfile-arg
Add --build-arg doc on Docker 1.13
2016-11-28 11:29:24 +08:00
Baohua Yang
590b0bea31 Merge pull request #135 from twang2218/image-remove
Refine the image remove chapter
2016-11-28 11:25:22 +08:00
Tao Wang
b0330ce1d8 修正 --build-arg 的参数的说明以适应 Docker 1.13 的变化
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-28 10:53:44 +11:00
Tao Wang
bd7b7c18c3 重写删除镜像章节
扩展了删除镜像的信息。
调整GitHub按钮的大小。

Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-28 02:29:45 +11:00
Baohua Yang
5230300d30 Merge pull request #132 from twang2218/image-create
Fix image link
2016-11-27 10:39:29 +08:00
Baohua Yang
fa3c55840c Merge pull request #133 from twang2218/fix-issue-131-github-buttons-problem
Fix #8 hide the github button when it's in mobile
2016-11-27 10:37:44 +08:00
Tao Wang
eb66a35128 Fix #8 hide the github button if it's mobile
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-27 07:14:25 +11:00
Tao Wang
3484bb3cf6 修正 image/commit.md 中的图片链接错误
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-27 04:34:38 +11:00
Baohua Yang
710956aed5 Merge pull request #129 from twang2218/install-mac
Use more explicit figure to show registry mirror preference
2016-11-26 18:04:53 +08:00
Baohua Yang
66b81709e7 Merge pull request #128 from twang2218/image-create
Add more content on image creation
2016-11-26 18:03:54 +08:00
Tao Wang
66de644f33 在 Mac 的配置界面上标记出来加速器的配置位置
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-26 19:11:40 +11:00
Tao Wang
5aec4fae19 重写定制镜像章节
由于定制镜像是 Docker 使用环境的重中之重,因此将原来的 `image/create.md` 扩展为4篇:`image/commit.md`, `image/build.md`, `image/dockerfile/*`, `image/other.md`。其中 `dockerfile` 进一步扩展,包括大部分指令详解。

由于 `image/dockerfile/*` 已经涵盖了 `dockefile/*` 的内容,并且增加了很多。因此去掉了原有的 `dockerfile/` 章节。从另一个角度来看,相当于是将后续 `dockerfile` 章节前移。
Dockerfile 是镜像构建必须掌握的技能,在介绍镜像定制的时候,就应该将其详细讲解。

将 `image/save_load.md` 合并到 `image/other.md` 并重写。docker import, export, save, load 是不常使用的命令,他们是早期 Docker 生态环境不完善的时候留下来的东西,现在已经不推荐使用,因此将这些方法合并到一篇里作为了解即可。

Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-26 05:02:43 +11:00
Baohua Yang
5cd720a388 Update compose 2016-11-25 22:24:48 +08:00
yeasy
5291db9ad4 Updates kubernetes/README.md 2016-11-25 22:21:21 +08:00
yeasy
414a7cd087 Updates SUMMARY.md
Auto commit by GitBook Editor
2016-11-25 22:19:47 +08:00
Baohua Yang
5385a8b0dc Merge pull request #127 from twang2218/update-book-json
Update book.json
2016-11-23 16:44:45 +08:00
Tao Wang
4aec4f9d7a 更新 book.json,代码色彩高亮换为默认的 highlight,并去除已经不再使用的 autocover 等
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-23 16:55:24 +11:00
Baohua Yang
ff5eb9d96a Merge pull request #126 from sugov5/master
Add how to use registry mirror on Win 10
2016-11-18 13:18:53 +08:00
TRISTAN-TK\Tristan_Liu
34a0655774 调整验证mirror配置的说明,验证方法只在Linux下生效。Windows下的验证方法暂时不知道 2016-11-17 21:42:30 +08:00
TRISTAN-TK\Tristan_Liu
72fbb7ed15 镜像加速器添加windows10配置说明 2016-11-17 21:36:22 +08:00
Baohua Yang
efb0afd0d9 Update minor version number 2016-11-15 14:30:38 +08:00
Baohua Yang
e84a08c4f2 Merge pull request #123 from twang2218/image-list
Add more details on image operations
2016-11-15 14:29:37 +08:00
Baohua Yang
d816cd15ad Merge pull request #124 from twang2218/install-mac
Add missing figures
2016-11-15 14:28:44 +08:00
Baohua Yang
48bf98a77b Merge pull request #125 from twang2218/namespace
Refine the term of 'namespace'
2016-11-15 14:28:24 +08:00
Tao Wang
a37cf1b88c 将 "名字空间" 改为 "命名空间"
Namespace 术语一般的翻译是"命名空间",参见 <https://zh.wikipedia.org/zh-cn/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4>

Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-15 06:56:29 +11:00
Tao Wang
f3be1fe1f5 重新改写"镜像列表"章节
更新命令结果,并添加更多的内容。

Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-15 06:40:27 +11:00
Tao Wang
4a114902d6 标出需要注意的图标,之前的提交忘记添加标注了。 2016-11-14 03:24:24 +11:00
Baohua Yang
3e0c0c6ef6 Merge pull request #121 from twang2218/install-merge
Merge installation steps on Ubuntu and Debian
2016-11-13 23:03:15 +08:00
Baohua Yang
20d632465b Merge pull request #122 from twang2218/install-mirror
Add more refs to registry mirror
2016-11-13 23:02:15 +08:00
Baohua Yang
f1b622ebfd Update pull.md 2016-11-13 23:01:49 +08:00
Baohua Yang
28cfc39b9c Update repository.md 2016-11-13 23:01:25 +08:00
Tao Wang
fc5d514ec1 添加关于加速器配置章节的引用。 2016-11-13 18:39:24 +11:00
Tao Wang
8889a6c8c3 修复笔误
Signed-off-by: Tao Wang <twang2218@gmail.com>
2016-11-13 18:29:14 +11:00
Tao Wang
45cdd756eb 合并 Ubuntu、Debian 安装文档
Ubuntu 和 Debian 系统的安装文档很相似,大部分可以共享,因此合并两个安装文档。
2016-11-13 18:24:59 +11:00
Baohua Yang
a119a30fa5 Merge pull request #118 from twang2218/image-pull
Refine image pull chapter
2016-11-13 09:01:29 +08:00
Baohua Yang
157923420f Merge branch 'twang2218-install-mirror' 2016-11-13 09:00:08 +08:00
Baohua Yang
48badeb0a0 Merge branch 'install-mirror' of https://github.com/twang2218/docker_practice into twang2218-install-mirror 2016-11-13 08:59:52 +08:00
Baohua Yang
3f0b68c21d Update mirror.md 2016-11-13 08:55:29 +08:00
Baohua Yang
6c60ad459c Merge pull request #119 from twang2218/install-mac
Add installation on MacOS
2016-11-13 08:54:10 +08:00
Tao Wang
f4e95e1215 添加配置加速器章节
由于伟大的墙,国内使用 Docker 需要配置加速器才可以访问 Docker Hub,这里添加配置加速器的章节。
2016-11-13 06:48:40 +11:00
Tao Wang
aee6aa8fe6 添加 "macOS 安装文档" 2016-11-13 04:08:44 +11:00
Tao Wang
3f41302794 改进'获取镜像'章节
修正一些表达,以及扩展更多信息。
关于下载缓慢的问题,改为推荐使用加速器,这样可以始终保持官方维护的新版本。因此在前面的安装章节将来需要补充一些安装配置的内容,包括加速器的设置。
2016-11-11 17:22:30 +11:00
Baohua Yang
6fd3097bd9 Merge pull request #117 from twang2218/sh-to-bash
Use bash in grammar marker instead of sh for better compatibility.
2016-11-11 10:23:39 +08:00
Tao Wang
df94a6e1fb 将所有的 "``sh" 替换为 "``bash"
这样更兼容 prism 避免报错。
2016-11-10 22:48:32 +11:00
Baohua Yang
d8be8f15a9 Merge pull request #116 from twang2218/install-centos
Refine Docker installation on CentOS
2016-11-10 17:39:23 +08:00
Baohua Yang
c5ac987475 Merge pull request #115 from twang2218/install-debian
Refine the installation on Debian
2016-11-10 17:38:54 +08:00
Tao Wang
d8858e5e3d 重写 CentOS 安装章节
按照 Ubuntu 结构重写 CentOS 安装章节。
去除 CentOS 6,因为已经不再被支持。
2016-11-10 08:55:43 +11:00
Tao Wang
c7c5731104 重写 'Debian 安装文档' 并改进 'Ubuntu 安装文档'
参照 Ubuntu 文档结构重写 Debian 的文档,很多内容很相似,或许将来有可能将二者合并。
2016-11-10 05:32:55 +11:00
Baohua Yang
65a1e69462 Merge pull request #114 from WALL-E/fix/nsenter
Update new version nsenter cmd
2016-11-09 22:02:16 +08:00
zhangzheng
e2158ef4fd update nsenter comment and download link 2016-11-09 16:16:46 +08:00
Baohua Yang
5b03c5d974 Merge pull request #112 from twang2218/install-ubuntu
Refine installation on Ubuntu
2016-11-09 11:23:37 +08:00
Tao Wang
442f829ef5 改进 Ubuntu 安装文档
去除 Ubuntu 15.10 的信息,Ubuntu 15.10 的软件生存周期已经结束;
用表格替代命令获取Ubuntu codename 的方式;
以及扩展更多的信息。
2016-11-09 06:18:30 +11:00
Baohua Yang
c4028b0016 Merge pull request #110 from twang2218/basic_concept
Refine the basic concept part
2016-11-08 11:17:02 +08:00
Tao Wang
01ff5ca004 修改一些笔误 2016-11-08 08:57:30 +11:00
Tao Wang
bdab0474c4 重写基础概念章节 2016-11-08 07:10:11 +11:00
Baohua Yang
46be5458ef Merge pull request #109 from twang2218/introduction-why
Add more content on why adopt Docker
2016-11-07 10:51:17 +08:00
Tao Wang
97d8e43b49 扩展 "为什么要使用 Docker" 文档
让文档更结构化,并且调整补充更多的信息
2016-11-07 07:00:17 +11:00
Baohua Yang
bf3100e68f Merge pull request #108 from twang2218/introduction-what
Add more info on Docker startup
2016-11-06 18:43:24 +08:00
Baohua Yang
57e97c6375 Fix ref link to wiki 2016-11-06 18:42:34 +08:00
Tao Wang
5c66e377f8 补充"什么是Docker"的信息,并且调整文字叙述顺序。 2016-11-06 06:52:43 +11:00
Baohua Yang
a63448d447 Add new group number 2016-10-29 11:30:26 +08:00
Baohua Yang
4fdbb1ee33 Merge pull request #107 from WALL-E/fix/swarm
Fix typo
2016-10-27 15:02:04 +08:00
zhangzheng
9fd3717645 fix the spelling mistakes 2016-10-27 10:34:02 +08:00
Baohua Yang
8437b4fd1f Merge pull request #106 from WALL-E/fix/compose
Fix  haproxy config in compose usage example
2016-10-25 17:26:48 +08:00
zhangzheng
3d9982357b fix compose usage, about haproxy config 2016-10-25 16:10:36 +08:00
Baohua Yang
b0626d8de8 Add new qq group 2016-09-28 16:50:48 +08:00
Baohua Yang
e7fffbae3a Merge pull request #104 from muicoder/master
Prettify cmd_logic.png
2016-09-21 14:26:01 +08:00
muicoder
8a68bf2108 prettify cmd_logic.png 2016-09-21 13:28:35 +08:00
Baohua Yang
7052c162e3 Merge pull request #103 from muicoder/master
Add color to cmd_logic figure
2016-09-20 22:06:30 +08:00
muicoder
73161f3758 cmd_logic 2016-09-20 17:57:15 +08:00
Baohua Yang
549d13b717 Merge pull request #102 from likang/patch-1
Use better terminologies
2016-09-14 14:23:42 +08:00
Kang Li
dcb2cfe246 better translations
Sorry I don't know much about the word 'save-out', but here are some common translations of docker commands in Chinese:

save: 保存
load: 加载
export: 导出 
import: 导入

It seems that there is a big difference between 'save' and 'export' in Docker, it will be great if you make a detail explanation :P
2016-09-14 13:37:21 +08:00
Kang Li
e4e10ead0f fix typo 2016-09-13 16:37:59 +08:00
Baohua Yang
4e70ce8578 Add new discuss group number 2016-09-02 14:39:25 +08:00
Baohua Yang
8a2846741b Merge pull request #100 from vra/master
Add missing period
2016-08-24 10:05:07 +08:00
Yunfeng Wang
18f3c52ba8 在句尾增加句号 2016-08-23 22:41:26 +08:00
Baohua Yang
d894237ab5 Merge pull request #99 from muicoder/master
Update container event states
2016-08-20 12:27:07 +08:00
muicoder
a4de63b13f Official container event states 2016-08-20 12:05:51 +08:00
Baohua Yang
66e3bfcb6f Merge pull request #98 from muicoder/master
Update cmd_logic.png image
2016-08-09 20:04:55 +08:00
tangyang
efef4590b6 fix "cmd_logic.png" image 2016-08-09 17:58:50 +08:00
Baohua Yang
36b9f63707 Merge pull request #97 from liu4480/master
Fix typo
2016-08-08 15:00:08 +08:00
Bin Liu
0c6490c510 change "回头" to "回收" in meos/architecture.md 2016-08-08 14:47:13 +08:00
Baohua Yang
accd03a8e9 Merge pull request #96 from liu4480/master
Fix a description in iptables
2016-08-08 11:17:56 +08:00
Bin Liu
8e0137347b fix a description in iptables 2016-08-08 09:53:53 +08:00
Baohua Yang
1fdc0dd63d Merge pull request #95 from muicoder/master
Fix image links and booting cmd
2016-08-07 11:59:19 +08:00
tangyang
7aab504ecb fix "fig chapter" image links 2016-08-07 11:40:47 +08:00
tangyang
6be8a72e81 Update fig-example-large.gif => fig-example-large.png 2016-08-07 11:27:18 +08:00
tangyang
a0f18930f3 For "-d", read "--rm" 2016-08-07 11:26:02 +08:00
tangyang
3c9695f9c1 fix "kubernetes chapter" image links 2016-08-07 11:24:04 +08:00
Baohua Yang
4e6a59ebc5 update cmd logic figure 2016-08-06 21:44:57 +08:00
Baohua Yang
26a6004ee5 update cmd logic figure 2016-08-06 21:41:23 +08:00
Baohua Yang
6ce541c063 Update with latest docker version 2016-08-06 17:55:09 +08:00
Baohua Yang
375512ec17 Add new cover page 2016-08-06 12:44:41 +08:00
Baohua Yang
6076ac618a Add node module to git ignore list 2016-08-06 12:40:53 +08:00
Baohua Yang
85c9b33621 Update book style 2016-08-06 10:59:01 +08:00
Baohua Yang
dede6be4d3 Merge pull request #93 from Pandoraemon/patch-1
Fix table format
2016-08-04 16:05:21 +08:00
Pandoraemon
3ed9e56dc3 表格的修订
表格显示有问题。
2016-08-04 14:41:40 +08:00
Baohua Yang
507ae54044 Update new group number 2016-07-30 17:57:27 +08:00
Baohua Yang
1ef669b5e7 Merge pull request #91 from vra/patch-1
Add period symbol
2016-07-30 17:47:53 +08:00
Yunfeng Wang
c0d6cc88d7 在句尾增加句号 2016-07-30 10:50:00 +08:00
Baohua Yang
69d34f7607 Merge pull request #90 from vra/master
Fix expression
2016-07-29 17:43:01 +08:00
Yunfeng Wang
904fb90f5b 修改句式错误
根据上下文,将`写着`改成了`写成`
2016-07-29 15:09:35 +08:00
Baohua Yang
308f8c6f5a Merge pull request #88 from dangzhiqiang/master
Fix listed elements
2016-07-18 14:58:26 +08:00
Baohua Yang
18bd64b147 Merge pull request #89 from airacle/master
Fix typo: 084 => 124
2016-07-18 14:57:34 +08:00
airacle
7b68db9dc6 084 => 124 2016-07-14 22:15:53 +08:00
dangzhiqiang
7c9ceaa4dc 更改列表显示格式
修复列表显示格式,之前版本会导致生成的PDF会多出一行,并且增加不必要的缩进。
.md格式显示也会多出一个短横线“-”。
2016-07-14 11:33:00 +08:00
Baohua Yang
2ccf861503 Merge pull request #87 from Novtopro/master
Update term
2016-06-17 20:28:22 +08:00
Novtopro He
1c4d30c374 名字空间 -> 命名空间 2016-06-17 11:07:18 +08:00
Baohua Yang
1af242e154 Add new group number 2016-06-15 16:03:47 +08:00
yeasy
9fa5ff18a7 Update content with latest docker cmd 2016-06-12 18:22:47 +08:00
yeasy
2044998a27 Update README.md 2016-06-12 18:03:38 +08:00
yeasy
a8e690e5f3 Merge pull request #85 from catroll/master
Fix link and figure.
2016-05-25 10:38:08 +08:00
catroll
0cabecc05f Update install/debian.md,Markdown Error 2016-05-25 09:53:45 +08:00
catroll
51c1f16947 Update compose/usage.md, repository/dockerhub.md, fix three hyperlink 2016-05-25 09:32:05 +08:00
catroll
3e04648a41 Update kubernets/intro.md, kubernetes_logo.svg => kubernetes_logo.png 2016-05-25 09:08:53 +08:00
yeasy
280432204f Merge pull request #84 from ytgs/master
Minor fix terms and add more installation steps.
2016-04-18 11:52:43 +08:00
ytgs
6e5aeba187 Update install/debian.md 2016-04-17 22:01:33 +08:00
ytgs
1089796d49 Update install/debian.md 2016-04-17 21:42:43 +08:00
ytgs
7d4df6e369 Update install/README.md 2016-04-17 21:29:12 +08:00
ytgs
45b0402226 Update SUMMARY.md 2016-04-17 21:28:48 +08:00
ytgs
bebc4f646c Create install/debian.md 2016-04-17 21:28:47 +08:00
ytgs
c9555eb0f5 Update SUMMARY.md 2016-04-17 21:28:41 +08:00
ytgs
33bfa4c9dc Update install/ubuntu.md 2016-04-17 21:08:21 +08:00
ytgs
a6368a8091 Update install/ubuntu.md 2016-04-17 20:10:47 +08:00
ytgs
55712f7bdf Update basic_concept/repository.md 2016-04-17 19:34:35 +08:00
ytgs
316b45f11a Update basic_concept/repository.md 2016-04-17 19:12:49 +08:00
ytgs
2fceed22ac Update basic_concept/container.md 2016-04-17 19:08:31 +08:00
ytgs
5fa1b6024a Update basic_concept/image.md 2016-04-17 19:08:10 +08:00
yeasy
c50cfe14e0 Add new qq group number 2016-04-08 17:14:24 +08:00
yeasy
34fc4eee76 Merge pull request #81 from duSupport/master
fix typo
2016-03-01 09:59:44 +08:00
ds
3bd6083e68 更正 安装 -> Ubuntu -> 系统要求 中的错别字 2016-02-29 13:09:30 +08:00
yeasy
a6acd08bd0 Update the Centos installation 2016-02-04 15:08:44 +08:00
yeasy
6274d552d6 Update the ubuntu os installation 2016-02-04 14:29:05 +08:00
Baohua Yang
e2544bcb28 release 0.6 2015-12-24 09:44:47 +08:00
yeasy
121f498011 Merge pull request #80 from LcpMarvel/image_create_text
fix image building description on installing the json application
2015-12-21 09:27:45 +08:00
lcp
7d9625ec25 修正镜像创建中json应用描述 2015-12-19 12:13:18 +08:00
yeasy
3ca35d9638 Merge pull request #79 from GameXG/master
fix path error in compose example
2015-12-16 11:31:38 +08:00
GameXG
c71cf6a731 修正 compose 例子错误
数据卷相对路径必须以 . 或 .. 开头,否则会被认为是卷名称,由于存在 “/” 会提示:ERROR: haproxy/haproxy.cfg includes invalid characters for a local volume name, only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed 

参考来源:https://docs.docker.com/compose/compose-file/
You can mount a relative path on the host, which will expand relative to the directory of the Compose configuration file being used. Relative paths should always begin with . or ...
2015-11-26 22:41:28 +08:00
yeasy
062f008435 Merge pull request #77 from rhinoceros/master
Resolve apache2 install dependency error
2015-10-14 13:19:43 +08:00
rhinoceros.xn
6158dda40e Update case/supervisor.md : Resolve apache2 install error
Resolve error below:


Step 5 : RUN apt-get install -y openssh-server apache2 supervisor
 ---> Running in 816b405cf0d1
Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 apache2 : Depends: apache2-mpm-worker (= 2.2.22-1ubuntu1) but it is not going to be installed or
                    apache2-mpm-prefork (= 2.2.22-1ubuntu1) but it is not going to be installed or
                    apache2-mpm-event (= 2.2.22-1ubuntu1) but it is not going to be installed or
                    apache2-mpm-itk (= 2.2.22-1ubuntu1) but it is not going to be installed
           Depends: apache2.2-common (= 2.2.22-1ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get install -y openssh-server apache2 supervisor' returned a non-zero code: 100
2015-10-13 13:53:05 +08:00
yeasy
692db8b6a2 Merge pull request #76 from zhangbaitong/master
Add coreos cluster quickstart section
2015-09-28 17:41:00 +08:00
zhangbaitong
3291d4795f coreos cluster quickstart section 2015-09-28 17:33:45 +08:00
yeasy
bfecf409ea Merge pull request #75 from zhangbaitong/master
Add coreos tools intro section
2015-09-28 15:15:02 +08:00
zhangbaitong
eb32546e3c coreos tools intro section 2015-09-28 11:43:40 +08:00
yeasy
cd59aaf167 Merge pull request #73 from zhangbaitong/master
Add coreos intro section
2015-09-06 08:58:22 +08:00
zhangbaitong
6066e9cc5a coreos intro 2015-09-06 08:50:13 +08:00
yeasy
4d60922fa3 Merge pull request #72 from dayiguizhen/patch-4
use -d to boot contianer
2015-08-28 17:55:33 +08:00
dayiguizhen
14fddb18be Update usage.md
更改加入集群的参数命令
2015-08-26 13:24:48 +08:00
yeasy
0dfe3ebcce Merge pull request #71 from dayiguizhen/patch-3
Fix swarm starting missing flag
2015-08-25 13:57:10 +08:00
dayiguizhen
99df02f626 Update usage.md
修改swarm加入集群的参数
2015-08-25 13:53:02 +08:00
yeasy
0a4bd48a79 Merge pull request #70 from dayiguizhen/patch-2
Update the figure url
2015-08-25 10:36:36 +08:00
dayiguizhen
9956994b76 Update intro.md
修改图片的地址
2015-08-25 10:32:53 +08:00
yeasy
e564a7d4da Merge pull request #69 from ChaoMai/master
Fix issue #68: Add missing -d flag to run container in background
2015-08-18 10:20:46 +08:00
Chao Mai
950dadf54d Fix issue #68: 在5.2 守护状态运行中,命令错误 2015-08-18 10:07:45 +08:00
yeasy
a7d45c5a16 Merge pull request #67 from dayiguizhen/patch-1
Update daemon.md
2015-08-03 10:08:32 +08:00
dayiguizhen
a435453b80 Update daemon.md
docker run -d 的含义是在后台运行容器并且输出容器的ID(Run container in background and print container ID),而不是以守护态运行容器。
2015-08-02 15:43:04 +08:00
Baohua Yang
5ba3d7b007 Merge branch 'master' of github.com:yeasy/docker_practice 2015-07-16 15:35:13 +08:00
Baohua Yang
bace19fdc0 Add more details on docker machine 2015-07-16 15:34:54 +08:00
Baohua Yang
76d8382136 reformat 2015-07-16 14:26:47 +08:00
Baohua Yang
17ecc5d33d Replace compose logo with latest version 2015-07-16 14:26:23 +08:00
yeasy
8043983d75 Merge pull request #66 from dayiguizhen/patch-1
fix link with http prefix
2015-07-15 16:14:46 +08:00
dayiguizhen
28c1490fc6 如果是docker.com是打不开的
会转到下面这个链接。
https://github.com/yeasy/docker_practice/blob/master/docker.com
2015-07-15 16:11:46 +08:00
Baohua Yang
f633c14de3 Fix issue#64, duplicated words 2015-07-07 11:08:58 +08:00
yeasy
f026a1bee0 Merge pull request #62 from jzk/cleanup
add commands to cleanup unused containers and images
2015-07-05 10:37:31 +08:00
yeasy
e0d2d0997f Merge pull request #61 from jzk/datavolume
Data volume expression revise.
2015-07-05 10:36:04 +08:00
Zhenkai Jiang
60ec1bf62c add sections to cleanup unused containers and images 2015-07-03 16:52:47 +08:00
Zhenkai Jiang
977221c5d1 add an example to validate restored data from data volume container 2015-07-03 16:23:46 +08:00
Zhenkai Jiang
72144f1032 fix a few vague descriptions for data volumes containers and backup/restore 2015-07-03 16:19:51 +08:00
Zhenkai Jiang
62aa90a3bf add/correct lifecycle information for data volumes 2015-07-03 16:17:28 +08:00
Baohua Yang
94c15606b3 Add mesos framework 2015-06-30 17:11:45 +08:00
Baohua Yang
215a5dec0b Add mesos chapter 2015-06-29 18:20:31 +08:00
Baohua Yang
2a6620036f Add the architecture design for k8s 2015-06-08 11:19:52 +08:00
Baohua Yang
c5a5656220 Refine the kubernetes chapter's structure 2015-06-08 10:51:42 +08:00
Baohua Yang
0e87b70fbf Add the section of kubectl, to be filled 2015-06-08 10:32:13 +08:00
Baohua Yang
03b1d1ffc0 Add the kubernetes quickstart 2015-06-08 10:26:08 +08:00
yeasy
eb6683fbd7 Merge pull request #60 from maguowei/master
format the expression
2015-06-07 22:36:02 +08:00
maguowei
345b0703a3 format text 2015-06-07 21:27:32 +08:00
Baohua Yang
7f4e4145b0 Fix content formatting and typos 2015-05-21 20:23:53 +08:00
Baohua Yang
c814568560 Split out the swarm scheduling and filter sections 2015-05-21 19:57:58 +08:00
yeasy
4cb1252a98 Merge pull request #59 from rio-2607/rio-docker-practice
Add the content for the docker-swarm project
2015-05-21 19:47:41 +08:00
rio-2607
a2231978ab Update usage.md 2015-05-21 19:36:59 +08:00
rio-2607
a3ca178621 Update usage.md 2015-05-20 21:56:41 +08:00
rio-2607
0b607e92a2 Update usage.md 2015-05-20 20:48:11 +08:00
rio-2607
29fcb84407 Update usage.md 2015-05-20 20:44:19 +08:00
rio-2607
d457323780 Update usage.md 2015-05-19 21:32:15 +08:00
rio-2607
f9c545dbfc update usage.md 2015-05-19 19:58:04 +08:00
rio-2607
ed893bea7e update intro.md 2015-05-18 21:24:13 +08:00
rio-2607
295b7cdb7f Update install.md 2015-05-18 20:24:14 +08:00
rio-2607
e4e3cca8d3 update install.md 2015-05-18 20:23:38 +08:00
yeasy
34a3c29865 Merge pull request #58 from UncleBarney/patch-1
Correct supervisor container name
2015-05-14 19:48:23 +08:00
Hechen Gao
b30d4a2328 Correct supervisor container name
The name of the container for configured supervisord container is incorrect.
It was: test/supervisords, while in the build step, we tagged it as test/supervisor.
2015-05-13 15:38:49 -07:00
Baohua Yang
5f59530d4c Add compose quick start example 2015-05-11 14:46:51 +08:00
Baohua Yang
52a1755ce7 Add more options for compose yaml file 2015-05-10 14:56:05 +08:00
Baohua Yang
547ebe6053 Start the swarm chapter 2015-05-08 20:10:44 +08:00
Baohua Yang
fdeeaba0b0 Start the machine chapter 2015-05-08 20:10:34 +08:00
Baohua Yang
8626d13738 Add the compose chapter 2015-05-08 20:10:01 +08:00
yeasy
36127abed9 Merge pull request #57 from milhu/patch-1
Update .bashrc_docker for CentOS usage
2015-05-08 13:12:28 +08:00
milhu
8e976258b5 Update .bashrc_docker for CentOS usage
resolve invalid option error and able to find nsenter automatically if it has been installed with path notified
2015-05-08 11:21:02 +08:00
Baohua Yang
1d864385af Change version number to 0.4 2015-05-08 10:47:47 +08:00
yeasy
068e2e948b Merge pull request #56 from tekkamanninja/tekkaman_fix
Fix typo in container/import_export.md:
2015-05-04 11:21:25 +08:00
Fu Wei
d61a0b7677 Fix typo in container/import_export.md:
test/buntu:v1.0 to test/ubuntu:v1.0
2015-04-27 15:46:37 +08:00
yeasy
da6bb5f174 Merge pull request #51 from custa/master
Fix typos and expression format.
2015-03-15 19:17:40 +08:00
custa
fd92e6e343 Update tomcat.md
排版错误
2015-03-12 16:36:11 +08:00
custa
39cb5ffa88 放到
错别字: 方到 -> 放到
2015-03-12 16:18:35 +08:00
custa
b66e84fb84 Update supervisor.md
### 安装 ssh、apache 和 supervisor
2015-03-12 16:17:18 +08:00
Baohua Yang
72f6c252be Remove useless files 2015-03-12 13:41:02 +08:00
Baohua Yang
1b576a7e2a Add the kubernetes chapter into summary 2015-03-12 13:32:39 +08:00
yeasy
dee055b261 Merge pull request #50 from custa/master
修改错别字:容器卷->数据卷
2015-03-12 13:22:58 +08:00
custa
9df06628d2 Update linking.md 2015-03-11 09:52:45 +08:00
custa
c1844c1345 Update container.md 2015-03-11 09:48:35 +08:00
waitfish
53b75686d7 Change QQ 2015-02-28 16:11:54 +08:00
yeasy
d43fefff44 Merge pull request #48 from weilaihui/master
kubernetes写到第二节
2015-02-26 20:54:38 +08:00
yeasy
d4b2e6bee8 Merge pull request #47 from you-n-g/master
Fix simple typo
2015-02-26 20:53:41 +08:00
xiaolinzi
2fc168142c 复制控制器 2015-02-26 18:16:08 +08:00
xiaolinzi
c06250ee20 kubernetes写到第二节 2015-02-26 18:16:08 +08:00
xiaolinzi
815aca0279 readme done 2015-02-26 18:16:08 +08:00
xiaolin
1c194b4738 test 2015-02-26 18:16:08 +08:00
Young Yang
6b1a7e5028 simple typo 2015-02-23 10:25:27 +08:00
yeasy
939af1884a Merge pull request #46 from you-n-g/master
just a simple type error
2015-02-21 13:21:04 +08:00
Young Yang
76fcc36ac9 just a simple type error 2015-02-12 22:48:10 +08:00
yeasy
6fb92461c4 Merge pull request #45 from zhangbaitong/master
fix url format
2015-02-12 14:01:32 +08:00
zhangbaitong
86a4b061b0 fix url format 2015-02-12 13:42:06 +08:00
yeasy
cba7c8017e Merge pull request #44 from zhangbaitong/master
fix url format
2015-02-12 12:04:46 +08:00
zhangbaitong
b7ed0ab7a4 fix url format 2015-02-12 11:56:29 +08:00
yeasy
7a87084d71 Update README.md
v0.3.4
2015-02-03 13:48:47 +08:00
yeasy
6375778e23 Merge pull request #41 from zhangbaitong/master
add CoreOS section
2015-01-31 12:56:18 +08:00
zhangbaitong
bf63c11c05 add coreos section 2015-01-31 12:47:27 +08:00
zhangbaitong
7cd6a94dc4 add coreos section 2015-01-31 12:43:20 +08:00
yeasy
b445841df7 Merge pull request #40 from copuzzle/master
Fix expression words.
2015-01-22 10:30:32 +08:00
copuzzle
fa9d217607 修改一些小细节 2015-01-21 22:20:03 +08:00
copuzzle
60d1e6f20d Merge branch 'master' of https://github.com/yeasy/docker_practice 2015-01-21 21:42:01 +08:00
yeasy
340af53f10 Merge pull request #39 from stamhe/master
Fix typos.
2015-01-20 19:34:33 +08:00
Stam He
4fff004b97 修改笔误 2015-01-20 15:26:33 +08:00
copuzzle
7ea165b3b4 暴漏 to 暴露 2015-01-15 20:47:16 +08:00
yeasy
842a81eb1c Merge pull request #38 from zhangbaitong/master
finished fig env ref
2015-01-15 10:25:48 +08:00
zhangbaitong
ff130ef077 finished fig env ref 2015-01-15 10:18:12 +08:00
zhangbaitong
57f53c031b finished fig env ref 2015-01-15 10:17:25 +08:00
yeasy
92925d2cb3 Merge pull request #37 from zhangbaitong/master
finished fig.yml ref
2015-01-15 08:37:59 +08:00
zhangbaitong
b424142791 finished fig.yml ref 2015-01-14 23:26:04 +08:00
zhangbaitong
8d40f74532 finished fig.yml ref 2015-01-14 23:22:04 +08:00
yeasy
285d69275a Merge pull request #35 from zhangbaitong/master
fix url address
2015-01-14 23:08:27 +08:00
zhangbaitong
34282977af use right format of md 2015-01-14 22:48:33 +08:00
zhangbaitong
42ca51db65 use right format of md 2015-01-14 22:45:59 +08:00
Baohua Yang
dd02308d91 Update summary to add recent content 2015-01-14 22:45:23 +08:00
yeasy
2da8779e68 Merge pull request #36 from copuzzle/master
Finish django rails wordpress chapters
2015-01-14 22:38:43 +08:00
copuzzle
e8607564a4 finished wordpress 2015-01-14 21:52:19 +08:00
copuzzle
753130f571 add wordpress content 2015-01-14 14:09:38 +08:00
copuzzle
9c5053b89c finished rails basicly 2015-01-14 13:46:21 +08:00
copuzzle
1cbd9645fc 修改句子 2015-01-14 10:51:02 +08:00
copuzzle
d473dabd78 finished django,add ml_ref.md 2015-01-14 10:03:47 +08:00
zhangbaitong
b0a61fb009 修改错别字 2015-01-14 09:29:16 +08:00
zhangbaitong
6f3898ae6b fix url address 2015-01-14 09:05:41 +08:00
copuzzle
7ccfec3f3b add django rails file and other images 2015-01-13 18:04:53 +08:00
yeasy
63264c623c Merge pull request #34 from zhangbaitong/master
update summary for fig cli chapter
2015-01-13 16:20:00 +08:00
zhangbaitong
8261449e42 update fig cli ref doc 2015-01-13 16:13:30 +08:00
yeasy
9a6bc4a1aa Merge pull request #33 from zhangbaitong/master
补充句子中遗留的命令
2015-01-13 16:10:22 +08:00
zhangbaitong
42785a15a7 add fig cli ref doc 2015-01-13 16:05:00 +08:00
zhangbaitong
d044ff923a 修改格式 2015-01-12 10:16:14 +08:00
zhangbaitong
e55429f64f 补充句子中遗留的命令 2015-01-11 21:47:22 +08:00
yeasy
69e0cc2c26 Merge pull request #30 from zhangbaitong/master
修改fig章节表述内容
2015-01-11 19:40:07 +08:00
zhangbaitong
94d7e664c3 修改内容表述问题 2015-01-07 15:55:00 +08:00
zhangbaitong
14cad7881f 修改错误表述内容 2015-01-07 14:03:12 +08:00
Baohua Yang
a93f3b4d2a Add the fig chapter into summary 2015-01-04 18:19:38 +08:00
yeasy
c5fd5f025c Merge pull request #29 from copuzzle/master
Fig 文档翻译, 简介,首页,安装章节
2015-01-04 17:57:06 +08:00
copuzzle
f80eed0e18 fix char 2015-01-01 22:21:30 +08:00
copuzzle
d2bbf9e4ca fix error char 2015-01-01 22:17:39 +08:00
copuzzle
544ee1de65 finish install section 2015-01-01 22:12:28 +08:00
copuzzle
8956a6b120 Merge branch 'master' of https://github.com/yeasy/docker_practice 2015-01-01 21:23:55 +08:00
copuzzle
36b6e29d59 add readme content
fix warring tag css
2015-01-01 21:21:33 +08:00
copuzzle
fbe187a743 fix image problem 2015-01-01 12:16:46 +08:00
Baohua Yang
971023ddca Minor change words 2014-12-31 18:32:46 +08:00
Baohua Yang
a977601251 Update version info in the preface content 2014-12-31 17:20:26 +08:00
Baohua Yang
589148450f Add etcd chapter 2014-12-31 17:11:09 +08:00
Baohua Yang
29b7568853 Start v0.4 writing, minor fix preface content 2014-12-31 10:08:27 +08:00
copuzzle
69d10ac09d fix som problem 2014-12-30 23:57:43 +08:00
copuzzle
c0dbca7a93 finish home page translate 2014-12-30 23:44:09 +08:00
copuzzle
dd24811386 add fig doc part 2014-12-30 14:46:50 +08:00
Baohua Yang
2392ba87ea Add links to china-pub 2014-12-22 09:47:00 +08:00
Baohua Yang
d4d430a99e Fix issue #28: maintainer information 2014-12-21 19:27:46 +08:00
Baohua Yang
201a2180a3 Merge branch 'master' of github.com:yeasy/docker_practice 2014-12-21 19:24:45 +08:00
Baohua Yang
070359c511 Refine the preface content 2014-12-21 19:24:20 +08:00
yeasy
7876ec1485 Merge pull request #27 from gaojice/master
试试如何贡献
2014-12-14 11:41:05 +08:00
gaojice
f945d9f209 试试如何贡献 2014-12-13 00:16:10 +08:00
Baohua Yang
9215e4b88e Publish v0.3 version 2014-11-25 13:38:43 +08:00
Baohua Yang
e5a297a7be Update ignore type list 2014-11-07 15:42:25 +08:00
Baohua Yang
34dc895942 Merge branch 'master' of github.com:yeasy/docker_practice 2014-11-07 15:27:30 +08:00
yeasy
d858b810be Merge pull request #22 from yougg/patch-1
修改部分错别字及描述信息
2014-11-06 20:34:49 +08:00
yougg
76b6a51f57 修改标点符号 2014-11-06 10:58:28 +08:00
yougg
6af4bdd1d1 修改错别字 2014-11-06 10:41:26 +08:00
yougg
8a7c23ce01 添加URL链接 2014-11-06 10:32:09 +08:00
yougg
089533127f 修改错别字 2014-11-06 10:28:19 +08:00
yougg
d0297f8da6 修改错别字 2014-11-06 10:19:56 +08:00
yougg
fb3ba14bdf 删除多余字 2014-11-06 10:16:10 +08:00
yougg
f9bdf3fe89 修改语句描述 2014-11-06 10:00:36 +08:00
yougg
6e9dea1ffe 修改"虚拟机"为"容器" 2014-11-06 09:47:21 +08:00
yougg
d7c88f7972 添加标题标记 2014-11-06 09:14:51 +08:00
yougg
05eb51961d 添加遗漏字 2014-11-06 09:06:49 +08:00
yougg
5fc06666c8 修改错别字 2014-11-05 17:37:37 +08:00
yougg
af2a0b28c5 修改语句描述
修改语句描述
2014-11-05 12:47:29 +08:00
Baohua Yang
fda6a07a1e Minor update ignore file; Add pull_all and push_all scripts 2014-10-30 15:30:51 +08:00
yeasy
f936efebd9 Update push_images.sh 2014-10-26 15:36:52 +08:00
Baohua Yang
16527880fb minor fix space; delete useless file 2014-10-21 13:59:03 +08:00
Baohua Yang
cb903202ba Fix issue#20, format following the guidelines 2014-10-14 13:25:01 +08:00
Baohua Yang
9d26f96ba2 Merge branch 'master' of github.com:yeasy/docker_practice 2014-10-12 10:32:14 +08:00
Baohua Yang
ed7c2a3ee7 User new dockerpool repo server address 2014-10-12 10:32:04 +08:00
Baohua Yang
894d8ebc62 Merge pull request #19 from luashiping/master
fix expose
2014-10-11 16:35:58 +08:00
lushiping
46195eb9f6 fix expose 2014-10-11 16:18:19 +08:00
Baohua Yang
d732713b06 Add dockerfile chapter 2014-10-10 17:30:53 +08:00
Baohua Yang
4e70438202 Rename the network chapter 2014-10-10 09:37:52 +08:00
Baohua Yang
5a642809d9 Minor changes on content 2014-10-10 09:37:15 +08:00
Baohua Yang
06b9651af9 Add more details to help understand repo and registry 2014-10-03 11:41:22 +08:00
Baohua Yang
8117a15804 Add comparison summary with vm 2014-10-03 11:34:57 +08:00
Baohua Yang
c48aa47432 minor change, add dockerpool link 2014-09-30 13:39:19 +08:00
Baohua Yang
d897954e8a Merge pull request #18 from patriot7/master
fix typo
2014-09-30 12:51:49 +08:00
Gao Xiang
1a6861476b fix typo 2014-09-29 17:36:46 -04:00
Baohua Yang
6fa5159bb9 Add new chapters to introduce the popular repositories 2014-09-27 16:06:08 +08:00
Baohua Yang
1faf0eeba6 rename the appendix chapter's directories 2014-09-27 13:26:40 +08:00
Baohua Yang
24191c2ebe Modify the import of bash file 2014-09-26 20:33:00 +08:00
Baohua Yang
e94bb1d13b Modify the usage of the bashrc file 2014-09-26 17:52:04 +08:00
Baohua Yang
7896cb5d7b Add more useful command 2014-09-26 17:46:05 +08:00
Baohua Yang
d4b8630bca Rewrite the introduction and minor fix 2014-09-26 17:45:51 +08:00
Baohua Yang
8857c11fa6 minor change to expression; unify the term and formatting 2014-09-26 16:05:13 +08:00
Baohua Yang
8add83dcc2 restruct the chapter to make it more understanding 2014-09-26 15:44:31 +08:00
Baohua Yang
6d890cab80 Note to start docker in ubuntu installation 2014-09-26 14:34:16 +08:00
Baohua Yang
0505622aeb Reformat the installation chapter 2014-09-26 14:14:13 +08:00
Baohua Yang
25c95840bf review the content 2014-09-26 14:08:26 +08:00
Baohua Yang
4098af51bc Update link to file directly 2014-09-25 22:09:04 +08:00
Baohua Yang
17ab6bcd7b Rewrite and add more details on attach and nsenter; add bashrc_docker file 2014-09-25 22:08:45 +08:00
Baohua Yang
73b5e3890e restruct and add brief introduction part 2014-09-25 17:23:05 +08:00
Baohua Yang
4901436e6b Use Docker instead of docker 2014-09-25 17:06:32 +08:00
Baohua Yang
37e650575f Merge pull request #17 from luashiping/master
add enter container
2014-09-25 16:55:53 +08:00
Baohua Yang
3d8dd3175f Add the repo configuration section 2014-09-25 16:46:37 +08:00
Baohua Yang
56fc8fd280 use -d to start container as daemon 2014-09-25 16:45:47 +08:00
Baohua Yang
d77c41dab7 Add contribution list 2014-09-25 16:45:03 +08:00
lushiping
5912b8fb00 add enter container 2014-09-25 16:09:50 +08:00
lushiping
929caa27e8 add enter container 2014-09-25 15:51:25 +08:00
lushiping
18507f9eaf Fix issue #1: change helo to hello 2014-09-25 15:42:21 +08:00
lushiping
ed6e476e94 Fix issue #1: change helo to hello 2014-09-25 15:31:18 +08:00
Baohua Yang
2422e4e19d Merge pull request #16 from hsgui/master
upstream without https:// could not work
2014-09-24 17:01:16 +08:00
hsgui
ec4e36bbf4 upstream without https:// could not work 2014-09-24 15:55:37 +08:00
Baohua Yang
ae67944ddf Merge pull request #15 from hsgui/master
Fix: change --volumne--from to --volumnes-from
2014-09-24 13:35:56 +08:00
Baohua Yang
cab41b6362 Merge pull request #14 from aisensiy/master
在 Image 章节发现的两个小错误
2014-09-24 13:34:52 +08:00
hsgui
10b432ab65 Fix: change --volumne--from to --volumnes-from 2014-09-24 13:10:32 +08:00
aisensiy
08ed01831a docker save is used to save image and docker export is used to export container 2014-09-24 12:27:00 +08:00
aisensiy
26620cb3d5 mysqld to httpd 2014-09-24 12:07:25 +08:00
Baohua Yang
a9825f93e9 Update local repo usage, add a batch script to upload local images 2014-09-24 11:03:46 +08:00
Baohua Yang
86f8095149 Add more examples on using local repo 2014-09-23 16:40:54 +08:00
Baohua Yang
ff245474dc Add the backup repo server 2014-09-23 15:07:38 +08:00
Baohua Yang
cef1322014 Fix issue#12, cmd should be run with root privilege 2014-09-23 13:45:50 +08:00
Baohua Yang
b5d4a05d4b Add more details to use the local repo 2014-09-23 13:14:45 +08:00
Baohua Yang
876ea4c9d6 Add more accurate link 2014-09-22 16:43:23 +08:00
Baohua Yang
9fd703bc18 Add change log 2014-09-22 16:43:05 +08:00
Baohua Yang
2a60b4ce7e Remove the local repo case, add its content into the image and repository sections 2014-09-22 16:40:18 +08:00
Baohua Yang
71bcec05b7 Rewrite the local repo deployment case 2014-09-22 15:52:53 +08:00
Baohua Yang
ed2750776a Rewrite the other security feature part and security summary part 2014-09-22 11:19:52 +08:00
Baohua Yang
07edb7e3c1 Update the term to better meaning 2014-09-22 10:56:15 +08:00
Baohua Yang
3e9f1343f0 Merge branch 'cxjava-master' 2014-09-22 10:05:24 +08:00
Baohua Yang
71f0f50f27 Merge branch 'master' of https://github.com/cxjava/docker_practice into cxjava-master
Conflicts:
	security/control_group.md
	security/daemon_sec.md
	security/kernel_capability.md
	security/kernel_ns.md
2014-09-22 10:04:22 +08:00
Baohua Yang
909dfb8e12 Merge branch 'master' of github.com:yeasy/docker_practice 2014-09-22 09:49:10 +08:00
Baohua Yang
554224406b Change section title 2014-09-22 09:47:08 +08:00
Baohua Yang
ca451d866f Merge pull request #10 from bill2004158/master
fix link url
2014-09-22 09:45:33 +08:00
bill2004158
eb203c80d5 fix link url 2014-09-22 00:43:50 +08:00
Baohua Yang
59abd4883d rewrite the kernel capability part 2014-09-21 22:07:06 +08:00
Baohua Yang
8c59d79c5b rewrite the daemon part 2014-09-21 21:44:55 +08:00
Baohua Yang
467edbe130 rewrite the control group part 2014-09-21 21:33:51 +08:00
Baohua Yang
64ed80de0d rewrite the kernel security part 2014-09-21 21:33:30 +08:00
Baohua Yang
ece126aa1b rewrite the introduction of docker security 2014-09-21 21:33:06 +08:00
Baohua Yang
337065434d Add cover pages 2014-09-21 21:32:42 +08:00
Baohua Yang
c5b81e3330 Add the book.json file 2014-09-21 21:32:13 +08:00
Charles
2a21c2f595 Merge branch 'master' of github.com:cxjava/docker_practice 2014-09-21 20:51:13 +08:00
Charles
96b199aae2 Fixed the wrong Chinese character 2 2014-09-21 20:50:55 +08:00
Charles
5d00f5476b Fixed the wrong Chinese character 2014-09-21 20:48:49 +08:00
Charles
39ef881ace Fixed the wrong Chinese character 2014-09-21 20:27:40 +08:00
Baohua Yang
672316dfb5 Change read link address to the front page 2014-09-21 18:19:09 +08:00
Baohua Yang
f0eb7ac601 restruct and publish new version 0.2.1 2014-09-21 13:58:23 +08:00
Baohua Yang
7f31be0ed9 rename 2014-09-21 13:51:26 +08:00
Baohua Yang
49c4143e27 rename 2014-09-21 13:50:34 +08:00
Baohua Yang
c184f014ae Merge pull request #8 from windwiny/patch-1
Update tomcat.md
2014-09-21 13:46:52 +08:00
Baohua Yang
7b0e52f309 Write the underly/network chapter 2014-09-21 13:40:10 +08:00
windwiny
aa3ff4dc6a Update tomcat.md 2014-09-21 11:47:56 +08:00
Baohua Yang
d544c2949f Update the instruction with latest official document 2014-09-20 21:50:27 +08:00
Baohua Yang
b94178ee16 Merge pull request #7 from kmiku7/master
Fix install commands on CentOS
2014-09-20 21:44:18 +08:00
kmiku7
4567e7e6f7 Fix install commands on CentOS 2014-09-21 02:15:13 +08:00
Baohua Yang
f4dc2303f6 Fix issue#6: clarify the differences between image:save,load and container:export,import 2014-09-19 21:51:21 +08:00
Baohua Yang
8dffa923bc minor revision; update link 2014-09-19 11:23:25 +08:00
Baohua Yang
2b40097e66 Add guide on how to participate the project 2014-09-18 22:13:12 +08:00
Baohua Yang
0e65e07e3d Add the section of network config file 2014-09-18 17:38:42 +08:00
Baohua Yang
23d4e36c64 rewrite the advanced network chapter 2014-09-18 17:38:20 +08:00
Baohua Yang
424e07993e Change to more accurate expression 2014-09-18 15:55:24 +08:00
Baohua Yang
a3d8341e27 rewrite the fast_config and dns part of the advanced network chapter 2014-09-18 14:09:51 +08:00
Baohua Yang
0d48072d5c rewrite the introduction of advanced network chapter; redraw the figure 2014-09-18 13:07:31 +08:00
Baohua Yang
b1e6415b8f Finish the basic content for the underly chapter 2014-09-18 10:45:17 +08:00
Baohua Yang
d83e318b8c reduce the technical part 2014-09-18 10:34:52 +08:00
Baohua Yang
1065a728ce minor fix 2014-09-17 23:25:32 +08:00
Baohua Yang
1ac18858b5 restruct and add more content to introduce cgroups, ufs and container format 2014-09-17 20:53:14 +08:00
Baohua Yang
99f9a77b3c fix link info 2014-09-17 20:30:06 +08:00
Baohua Yang
b20eb11659 Add more detailed comments 2014-09-17 20:26:35 +08:00
Baohua Yang
6c1eeadd14 write the repository chapter content 2014-09-17 20:18:51 +08:00
Baohua Yang
faacf4c31d fix formatting and content 2014-09-17 19:42:22 +08:00
Baohua Yang
beb5a07855 change terminology 2014-09-17 19:36:51 +08:00
Baohua Yang
edbc260ba9 Merge branch 'master' of github.com:yeasy/docker_practice
Conflicts:
	practice/supervisor.md
2014-09-17 19:33:05 +08:00
Baohua Yang
7fda9225a1 fix code formatting and rewrite part content 2014-09-17 19:23:52 +08:00
Baohua Yang
2b90922922 Merge pull request #3 from dreampuf/patch-1
Fix a code block issue
2014-09-17 19:23:20 +08:00
Baohua Yang
cdb5a2b4c7 Merge pull request #2 from liangry/master
Fix permission denied error in ubuntu installation
2014-09-17 19:20:54 +08:00
Baohua Yang
22afe36b0f fix the terminologies, add more content 2014-09-17 16:31:25 +08:00
Dreampuf
2403f6e73d Fix codeblock issue 2014-09-17 16:22:47 +08:00
Dreampuf
4ad69eb796 Fix a codeblock issue 2014-09-17 16:21:41 +08:00
Baohua Yang
7f5c1acf09 refine the expression 2014-09-17 16:14:22 +08:00
Baohua Yang
a228773062 Add the original manual file by waitfish 2014-09-17 15:59:23 +08:00
Dreampuf
910786014e Fix a code block issue 2014-09-17 15:14:33 +08:00
Baohua Yang
4abab290ac Add .idea and _book directories into gitignore file 2014-09-17 14:59:13 +08:00
Baohua Yang
389c15d748 rename images directory to _images 2014-09-17 14:52:55 +08:00
Baohua Yang
c50e2aaf60 change the struct of image chapter, add export/import and join the docker hub related operations together 2014-09-17 14:33:06 +08:00
Baohua Yang
615bb9f517 Add more content 2014-09-17 14:16:45 +08:00
Ruoyu
c057d68cec Fix permission denied error in ubuntu installation 2014-09-17 14:16:08 +08:00
Baohua Yang
3ec888c77a Based on pull request#1, change the figure name suffix 2014-09-17 14:14:58 +08:00
Baohua Yang
99b0f8fe72 Fix terms 2014-09-17 13:45:13 +08:00
Baohua Yang
34d63d30f3 Rewrite the data_management chapter 2014-09-16 13:31:53 +08:00
Baohua Yang
dbb12986da Add more information on the discuss group 2014-09-16 10:26:19 +08:00
Baohua Yang
64a0f39dff rewrite the container, network chapters 2014-09-15 22:30:23 +08:00
Baohua Yang
da60ad7b47 Add image/list.md and dockerfile chapter 2014-09-15 21:51:21 +08:00
Baohua Yang
2c939cf20f Fix word in image chapter 2014-09-15 21:28:09 +08:00
Baohua Yang
e91a4955e9 Add the container chapter 2014-09-15 21:25:36 +08:00
Baohua Yang
fc7aa02f50 Finish the basic version of the basic_concept chapter 2014-09-15 17:36:31 +08:00
Baohua Yang
813c3bdab1 Add two chapters:container and repository 2014-09-15 17:11:22 +08:00
Baohua Yang
80eda65481 Restruct and start rewring. 2014-09-15 17:08:06 +08:00
Baohua Yang
f14fddbba8 minor fix 2014-09-14 14:04:30 +08:00
Baohua Yang
a9dddd5bc1 Add resources chapter 2014-09-14 14:01:26 +08:00
Baohua Yang
68e02605f6 Add more commands in creating an image 2014-09-14 13:57:19 +08:00
Baohua Yang
743a09086a Add cover figure 2014-09-12 20:34:15 +08:00
Baohua Yang
e6986e387e minor change 2014-09-12 16:18:48 +08:00
Baohua Yang
71adb73dbb Rewrite the content 2014-09-12 16:18:24 +08:00
Baohua Yang
e6883a4ef2 Refine and fix 2014-09-12 16:17:56 +08:00
Baohua Yang
7fc1ca0733 split the installation to two main distributions 2014-09-12 15:37:21 +08:00
Baohua Yang
79934ad3e1 Add figure for the command logic 2014-09-12 15:36:41 +08:00
Baohua Yang
0258da9046 fix wrong link name 2014-09-12 11:01:57 +08:00
Baohua Yang
e0405a38d6 rename the first chapter 2014-09-12 10:52:17 +08:00
Baohua Yang
afa47edf45 Add docker command page 2014-09-12 10:51:47 +08:00
Baohua Yang
f5ab41b2fa Add new chapters: the docker command 2014-09-11 22:52:57 +08:00
Baohua Yang
1d101330fd express refine 2014-09-11 22:52:28 +08:00
Baohua Yang
1f5fb2d521 Rewrite part of the architecture introduction 2014-09-11 17:07:49 +08:00
Baohua Yang
235a80aad8 Write paragraphs to explain why we need docker; minor grammar fix. 2014-09-11 16:56:34 +08:00
238 changed files with 9512 additions and 990 deletions

10
.gitignore vendored
View File

@@ -1,3 +1,11 @@
# Created by .gitignore support plugin (hsz.mobi)
*.~
*.tmp
*.tmp
.idea/
_book/
*.swp
*.edx
.DS_Store
node_modules/

136
README.md
View File

@@ -1,19 +1,129 @@
Docker -- 从入门到实践
===============
# Docker 从入门到实践
v0.1
0.8.0
[Docker] (docker.com)是个伟大的项目
[Docker](http://www.docker.com) 是个划时代的开源项目,它彻底释放了计算虚拟化的威力,极大提高了应用的运行效率,降低了云计算资源供应的成本! 使用 Docker可以让应用的部署、测试和分发都变得前所未有的高效和轻松
本书最初源于[WaitFish](mailto:dwj_wz@163.com)
创作的<Docker学习手册v1.0> pdf内容后来[yeasy](github.com/yeasy)
根据最新的官方文档对内容进行了修订,并与作者[WaitFish]
(mailto:dwj_wz@163
.com)协商,将内容开源,采用互联网合作的方式进行创作和维护。
无论是应用开发者、运维人员、还是其他信息技术从业人员,都有必要认识和掌握 Docker以在有限的时间内做更多有意义的事。
在线阅读:[https://www.gitbook.io/book/yeasy/docker_practice](https://www.gitbook.io/book/yeasy/docker_practice)
本书既适用于具备基础 Linux 知识的 Docker 初学者,也希望可供理解原理和实现的高级用户参考。同时,书中给出的实践案例,可供在进行实际部署时借鉴。前六章为基础内容,供用户理解 Docker 的基本概念和操作7 ~ 9 章介绍一些高级操作;第 10 章给出典型的应用场景和实践案例11、12 章介绍关于 Docker 安全和实现技术等高级话题。后续章节则分别介绍一些相关的热门开源项目。
维护本书的Github项目: [https://github.com/yeasy/docker_practice](https://github
.com/yeasy/docker_practice)
在线阅读:[GitBook](https://www.gitbook.io/book/yeasy/docker_practice) 或 [Github](https://github.com/yeasy/docker_practice/blob/master/SUMMARY.md)。
欢迎大家提交pull request。
* pdf 版本 [下载](https://www.gitbook.com/download/pdf/book/yeasy/docker_practice)
* epub 版本 [下载](https://www.gitbook.com/download/epub/book/yeasy/docker_practice)
欢迎关注 DockerPool 社区微博 [@dockerpool](http://weibo.com/u/5345404432),或加入 Docker 技术交流 QQ 群或微信组,分享 Docker 资源,交流 Docker 技术。
* QQ 群 I 已满341410255
* QQ 群 II 已满419042067
* QQ 群 III 已满210028779
* QQ 群 IV 已满483702734
* QQ 群 V 已满460598761
* QQ 群 VI 已满581983671
* QQ 群 VII 已满252403484
* QQ 群 VIII已满544818750
* QQ 群 IX 已满571502246
* QQ 群 X 可加366203473
![Docker 技术入门与实战](_images/docker_primer.png)
《[Docker 技术入门与实战](http://item.jd.com/11598400.html)》一书已经正式出版,包含大量第一手实战案例和更为深入的技术剖析,欢迎大家阅读使用并反馈建议。
* [China-Pub](http://product.china-pub.com/3770833)
* [京东图书](http://item.jd.com/11598400.html)
* [当当图书](http://product.dangdang.com/23620853.html)
* [亚马逊图书](http://www.amazon.cn/%E5%9B%BE%E4%B9%A6/dp/B00R5MYI7C/ref=lh_ni_t?ie=UTF8&psc=1&smid=A1AJ19PSB66TGU)
## 主要版本历史
* 0.8.0: 2017-01-08
* 修正文字内容
* 根据最新版本修订安装使用
* 补充附录章节
* 0.7.0: 2016-06-12
* 根据最新版本进行命令调整
* 修正若干文字描述
* 0.6.0: 2015-12-24
* 补充 Machine 项目
* 修正若干 bug
* 0.5.0: 2015-06-29
* 添加 Compose 项目
* 添加 Machine 项目
* 添加 Swarm 项目
* 完善 Kubernetes 项目内容
* 添加 Mesos 项目内容
* 0.4.0: 2015-05-08
* 添加 Etcd 项目
* 添加 Fig 项目
* 添加 CoreOS 项目
* 添加 Kubernetes 项目
* 0.3.0: 2014-11-25
* 完成仓库章节;
* 重写安全章节;
* 修正底层实现章节的架构、命名空间、控制组、文件系统、容器格式等内容;
* 添加对常见仓库和镜像的介绍;
* 添加 Dockerfile 的介绍;
* 重新校订中英文混排格式。
* 修订文字表达。
* 发布繁体版本分支zh-Hant。
* 0.2.0: 2014-09-18
* 对照官方文档重写介绍、基本概念、安装、镜像、容器、仓库、数据管理、网络等章节;
* 添加底层实现章节;
* 添加命令查询和资源链接章节;
* 其它修正。
* 0.1.0: 2014-09-05
* 添加基本内容;
* 修正错别字和表达不通顺的地方。
Docker 自身仍在快速发展中,生态环境也在蓬勃成长。源码开源托管在 Github 上,欢迎参与维护:[https://github.com/yeasy/docker_practice](https://github.com/yeasy/docker_practice)。贡献者 [名单](https://github.com/yeasy/docker_practice/graphs/contributors)。
## 参加步骤
* 在 GitHub 上 `fork` 到自己的仓库,如 `docker_user/docker_practice`,然后 `clone` 到本地,并设置用户信息。
```sh
$ git clone git@github.com:docker_user/docker_practice.git
$ cd docker_practice
$ git config user.name "yourname"
$ git config user.email "your email"
```
* 修改代码后提交,并推送到自己的仓库。
```sh
$ #do some change on the content
$ git commit -am "Fix issue #1: change helo to hello"
$ git push
```
* 在 GitHub 网站上提交 pull request。
* 定期使用项目仓库内容更新自己仓库内容。
```sh
$ git remote add upstream https://github.com/yeasy/docker_practice
$ git fetch upstream
$ git checkout master
$ git rebase upstream/master
$ git push -f origin master
```
## 鼓励项目
欢迎鼓励项目一杯 coffee~
![coffee](_images/donate.jpeg)

View File

@@ -1,53 +1,137 @@
#目录
* [为什么要使用docker](why_use_docker/README.md)
- [快速交付应用程序](why_use_docker/fast_deployment.md)
- [更容易部署和扩展](why_use_docker/easy_deployment.md)
- [效率更高](why_use_docker/high_efficiency.md)
- [快速部署也意味着更简单的管理](why_use_docker/easy_management.md)
* [Docker的体系结构](arch/README.md)
- [内部组件](arch/internal.md)
- [image的工作原理](arch/image.md)
- [仓库](arch/repo.md)
- [容器](arch/container.md)
- [底层技术](arch/underly.md)
# Summary
* [前言](README.md)
* [Docker 简介](introduction/README.md)
* [什么是 Docker](introduction/what.md)
* [为什么要用 Docker](introduction/why.md)
* [基本概念](basic_concept/README.md)
* [镜像](basic_concept/image.md)
* [容器](basic_concept/container.md)
* [仓库](basic_concept/repository.md)
* [安装](install/README.md)
- [Ubuntu 14.04](install/ubuntu144.md)
- [Ubuntu 12.04](install/ubuntu124.md)
- [CentOS](install/centos.md)
* [image介绍](image/README.md)
- [获取mage](image/get.md)
- [查找image](image/search.md)
- [下载image](image/download.md)
- [创建自己的image](image/create.md)
- [上传image](image/push.md)
- [移除本地image](image/rmi.md)
* [网络介绍](network/README.md)
- [端口映射](network/port_mapping.md)
- [docker中的容器互联-linking系统](network/linking.md)
* [高级网络配置](advanced_network/README.md)
- [快速配置](advanced_network/fast_config.md)
- [配置DNS](advanced_network/dns.md)
- [容器之间的通信](advanced_network/communication.md)
- [映射一个容器端口到宿主主机](advanced_network/port_mapping.md)
- [定制docker0](advanced_network/docker0.md)
- [创建自己的桥接](advanced_network/bridge.md)
- [Docker 如何连接到容器](advanced_network/how_connect.md)
- [工具和示例](advanced_network/example.md)
- [创建一个点到点连接](advanced_network/ptp.md)
* [Ubuntu、Debian](install/ubuntu.md)
* [CentOS](install/centos.md)
* [macOS](install/mac.md)
* [镜像加速器](install/mirror.md)
* [镜像](image/README.md)
* [获取镜像](image/pull.md)
* [列出镜像](image/list.md)
* [利用 commit 理解镜像构成](image/commit.md)
* [使用 Dockerfile 定制镜像](image/build.md)
* [Dockerfile 指令详解](image/dockerfile/README.md)
* [COPY 复制文件](image/dockerfile/copy.md)
* [ADD 更高级的复制文件](image/dockerfile/add.md)
* [CMD 容器启动命令](image/dockerfile/cmd.md)
* [ENTRYPOINT 入口点](image/dockerfile/entrypoint.md)
* [ENV 设置环境变量](image/dockerfile/env.md)
* [ARG 构建参数](image/dockerfile/arg.md)
* [VOLUME 定义匿名卷](image/dockerfile/volume.md)
* [EXPOSE 暴露端口](image/dockerfile/expose.md)
* [WORKDIR 指定工作目录](image/dockerfile/workdir.md)
* [USER 指定当前用户](image/dockerfile/user.md)
* [HEALTHCHECK 健康检查](image/dockerfile/healthcheck.md)
* [ONBUILD 为他人作嫁衣裳](image/dockerfile/onbuild.md)
* [参考文档](image/dockerfile/references.md)
* [其它制作镜像的方式](image/other.md)
* [删除本地镜像](image/rmi.md)
* [实现原理](image/internal.md)
* [容器](container/README.md)
* [启动](container/run.md)
* [守护态运行](container/daemon.md)
* [终止](container/stop.md)
* [进入容器](container/enter.md)
* [导出和导入](container/import_export.md)
* [删除](container/rm.md)
* [仓库](repository/README.md)
* [Docker Hub](repository/dockerhub.md)
* [私有仓库](repository/local_repo.md)
* [配置文件](repository/config.md)
* [数据管理](data_management/README.md)
- [数据卷](data_management/volume.md)
- [数据卷容器](data_management/container.md)
- [备份、恢复、移数据卷](data_management/management.md)
* [容器安全](container_security/README.md)
- [内核名字空间](container_security/kernel_ns.md)
- [控制组](container_security/control_group.md)
- [守护进程安全](container_security/daemon_sec.md)
- [内核权限](container_security/kernel_capability.md)
- [其他内核安全特性](container_security/other_feature.md)
- [结论](container_security/summary.md)
* [实战案例](practice/README.md)
- [部署本地仓库](practice/local_repo.md)
- [在Docker中使用 Supervisor来管理进程](practice/supervisor.md)
* [创建tomcat/weblogic集群](practice/tomcat.md)
* [多台物理主机之间的容器互联](practice/container_connect.md)
* [中小企业docker环境搭建](practice/environment.md)
* [数据卷](data_management/volume.md)
* [数据卷容器](data_management/container.md)
* [备份、恢复、移数据卷](data_management/management.md)
* [使用网络](network/README.md)
* [外部访问容器](network/port_mapping.md)
* [容器互联](network/linking.md)
* [高级网络配置](advanced_network/README.md)
* [快速配置指南](advanced_network/quick_guide.md)
* [配置 DNS](advanced_network/dns.md)
* [容器访问控制](advanced_network/access_control.md)
* [端口映射实现](advanced_network/port_mapping.md)
* [配置 docker0 网桥](advanced_network/docker0.md)
* [自定义网桥](advanced_network/bridge.md)
* [工具和示例](advanced_network/example.md)
* [编辑网络配置文件](advanced_network/config_file.md)
* [实例:创建一个点到点连接](advanced_network/ptp.md)
* [实战案例](cases/README.md)
* [使用 Supervisor 来管理进程](cases/supervisor.md)
* [创建 tomcat\/weblogic 集群](cases/tomcat.md)
* [多台物理主机之间的容器互联](cases/container_connect.md)
* [标准化开发测试和生产环境](cases/environment.md)
* [安全](security/README.md)
* [内核命名空间](security/kernel_ns.md)
* [控制组](security/control_group.md)
* [服务端防护](security/daemon_sec.md)
* [内核能力机制](security/kernel_capability.md)
* [其它安全特性](security/other_feature.md)
* [总结](security/summary.md)
* [底层实现](underly/README.md)
* [基本架构](underly/arch.md)
* [命名空间](underly/namespace.md)
* [控制组](underly/cgroups.md)
* [联合文件系统](underly/ufs.md)
* [容器格式](underly/container_format.md)
* [网络](underly/network.md)
* [Docker Compose 项目](compose/README.md)
* [简介](compose/intro.md)
* [安装与卸载](compose/install.md)
* [使用](compose/usage.md)
* [命令说明](compose/commands.md)
* [YAML 模板文件](compose/yaml_file.md)
* [实战 Django](compose/django.md)
* [实战 Rails](compose/rails.md)
* [实战 wordpress](compose/wordpress.md)
* [Docker Machine 项目](machine/README.md)
* [简介](machine/intro.md)
* [安装](machine/install.md)
* [使用](machine/usage.md)
* [Docker Swarm 项目](swarm/README.md)
* [简介](swarm/intro.md)
* [安装](swarm/install.md)
* [使用](swarm/usage.md)
* [调度器](swarm/scheduling.md)
* [过滤器](swarm/filter.md)
* [Etcd 项目](etcd/README.md)
* [简介](etcd/intro.md)
* [安装](etcd/install.md)
* [使用 etcdctl](etcd/etcdctl.md)
* [CoreOS 项目](coreos/README.md)
* [简介](coreos/intro.md)
* [工具](coreos/intro_tools.md)
* [快速搭建CoreOS集群](coreos/quickstart.md)
* [Kubernetes 项目](kubernetes/README.md)
* [简介](kubernetes/intro.md)
* [快速上手](kubernetes/quickstart.md)
* [基本概念](kubernetes/concepts.md)
* [kubectl 使用](kubernetes/kubectl.md)
* [架构设计](kubernetes/design.md)
* [Mesos 项目](mesos/README.md)
* [简介](mesos/intro.md)
* [安装与使用](mesos/installation.md)
* [原理与架构](mesos/architecture.md)
* [配置项解析](mesos/configuration.md)
* [常见框架](mesos/framework.md)
* [附录](appendix/README.md)
* [附录一:常见问题总结](appendix/faq/README.md)
* [附录二:热门镜像介绍](appendix/repo/README.md)
* [Ubuntu](appendix/repo/ubuntu.md)
* [CentOS](appendix/repo/centos.md)
* [MySQL](appendix/repo/mysql.md)
* [MongoDB](appendix/repo/mongodb.md)
* [Redis](appendix/repo/redis.md)
* [Nginx](appendix/repo/nginx.md)
* [WordPress](appendix/repo/wordpress.md)
* [Node.js](appendix/repo/nodejs.md)
* [附录三Docker 命令查询](appendix/command/README.md)
* [附录四:资源链接](appendix/resources/README.md)

BIN
_images/compose.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

BIN
_images/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
_images/docker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

BIN
_images/docker_compose.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
_images/docker_machine.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
_images/docker_primer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
_images/donate.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

BIN
_images/etcd_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 KiB

BIN
_images/install-mac-dmg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

BIN
_images/kube-proxy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

BIN
_images/kubernetes_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

374
_images/kubernetes_logo.svg Normal file
View File

@@ -0,0 +1,374 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="562.78589"
height="134.62993"
id="svg2"
xml:space="preserve"><metadata
id="metadata8"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs6" /><g
transform="matrix(1.25,0,0,-1.25,-169.2546,1414.8444)"
id="g10"><g
transform="matrix(0,0.18092,-0.18275,0,0,0)"
id="g12"><path
d="m 6196.6587,-1043.6173 -94.2902,-195.4939 -211.9113,-48.3046 -169.9617,135.2607 -0.025,216.9692 169.9297,135.2974 211.9254,-48.257 94.3336,-195.4718 z"
id="path14"
style="fill:none;stroke:#ffffff;stroke-width:118.52590179;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 190.7198,1121.0876 35.725,-17.0586 8.8274,-38.3391 -24.7181,-30.7489 -39.6505,0 -24.7249,30.7434 8.8192,38.3412 35.7219,17.0665 z"
id="path16"
style="fill:#336ee5;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0,0.18092,-0.18275,0,0,0)"
id="g18"><path
d="m 6196.6587,-1043.6173 -94.2888,-195.4939 -211.9141,-48.3046 -169.9603,135.2593 -0.025,216.9723 169.9297,135.2942 211.9237,-48.2572 94.3353,-195.4701 z"
id="path20"
style="fill:none;stroke:#336ee5;stroke-width:74.74790192;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><g
transform="scale(0.18275,0.18275)"
id="g22"><path
d="m 1013.0746,6022.3961 c 73.5242,16.6963 146.8298,-29.4129 163.7263,-102.9881 16.9013,-73.5693 -29.0033,-146.7459 -102.5258,-163.4409 -73.5273,-16.6903 -146.8343,29.4189 -163.7325,102.9867 -16.8967,73.5769 29.0047,146.7505 102.532,163.4423 z"
id="path24"
style="fill:none;stroke:#ffffff;stroke-width:30.78089905;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 188.4186,1104.8074 2.7468,-0.01 0.1749,-20.1918 -4.0657,-0.038 1.144,20.236 z"
id="path26"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="scale(0.17178,0.18275)"
id="g28"><path
d="m 1096.8024,6045.6095 15.9899,-0.036 1.0191,-110.4894 -23.6699,-0.2094 6.6609,110.7345 z"
id="path30"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 193.0309,1104.8074 -2.7474,-0.01 -0.1703,-20.1918 4.0654,-0.037 -1.1477,20.2354 z"
id="path32"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="scale(0.17178,0.18275)"
id="g34"><path
d="m 1123.6518,6045.6098 -15.993,-0.036 -0.991,-110.4894 23.6681,-0.2029 -6.6841,110.7283 z"
id="path36"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 192.8625,1112.4315 c 0,-1.3119 -0.9576,-2.3758 -2.1382,-2.3758 -1.1806,0 -2.1379,1.0639 -2.1379,2.3752 0,1.3119 0.9564,2.3754 2.1379,2.3763 1.1806,0 2.1382,-1.0636 2.1382,-2.3757"
id="path38"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.16447,2e-5,-2e-5,0.18275,0,0)"
id="g40"><path
d="m 1173.5053,6087.183 c -8e-4,-7.1804 -5.8238,-12.9997 -13.0019,-12.9988 -7.1785,8e-4 -12.998,5.8229 -12.9969,12.9971 0,7.1819 5.817,13.0011 13.0006,13.0031 7.1781,-6e-4 12.9994,-5.8229 12.9982,-13.0014 z"
id="path42"
style="fill:none;stroke:#ffffff;stroke-width:0.2744;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 188.5873,1112.4629 c 5e-4,-0.1876 -0.009,-0.458 -0.003,-0.6389 0.0289,-0.7566 0.1945,-1.3368 0.294,-2.0344 0.1797,-1.4922 0.3311,-2.7289 0.2381,-3.8781 -0.0851,-0.5757 -0.4184,-0.8028 -0.6959,-1.0689 l 3.3721,-2.2315 -0.5069,9.8354 -2.6988,0.016 z"
id="path44"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0,-0.17178,0.18275,0,0,0)"
id="g46"><path
d="m -6476.0579,1031.9675 c 1.0925,0 2.6666,-0.048 3.7194,-0.014 4.4045,0.1568 7.7839,1.0641 11.8431,1.6087 8.6865,0.9819 15.8862,1.8102 22.5791,1.3028 3.3483,-0.4652 4.6701,-2.2896 6.2212,-3.8095 l 12.9884,18.4555 -57.257,-2.7751 -0.094,-14.7685 z"
id="path48"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 192.8625,1112.4629 c -0.001,-0.1876 0.008,-0.458 0.002,-0.6389 -0.0289,-0.7566 -0.1942,-1.3368 -0.2934,-2.0344 -0.1797,-1.4922 -0.3311,-2.7289 -0.2384,-3.8781 0.0847,-0.5757 0.4184,-0.8028 0.6959,-1.0689 l -3.3724,-2.2315 0.5074,9.8354 2.6989,0.016 z"
id="path50"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0,-0.17178,0.18275,0,0,0)"
id="g52"><path
d="m -6476.0579,1055.3604 c 1.0925,0 2.6666,0.046 3.7194,0.011 4.4045,-0.1534 7.7839,-1.0624 11.8431,-1.6022 8.6865,-0.9867 15.8862,-1.815 22.5791,-1.3076 3.3483,0.4669 4.6701,2.291 6.2212,3.8081 l 12.9884,-18.4541 -57.257,2.7765 -0.094,14.7685 z"
id="path54"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><g
transform="scale(0.18275,0.18275)"
id="g56"><path
d="m 1073.7275,5865.2637 -30.1062,-14.4303 -30.1,14.438 -7.4344,32.4422 20.8395,26.0065 33.4099,0 20.8321,-26.0175 -7.4409,-32.4374 z"
id="path58"
style="fill:none;stroke:#ffffff;stroke-width:30.34600067;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 166.9153,1092.2468 1.7178,2.1436 15.8952,-12.4532 -2.5049,-3.2023 -15.1081,13.5119 z"
id="path60"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.1071,0.1343,-0.14288,0.11394,0,0)"
id="g62"><path
d="m 5577.0313,3012.37 15.9908,-0.036 1.0134,-110.4917 -23.6665,-0.2083 6.6623,110.7357 z"
id="path64"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 169.7905,1095.853 -1.7074,-2.1523 15.6805,-12.723 2.5636,3.1561 -16.5367,11.7192 z"
id="path66"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.1071,0.1343,-0.14288,0.11394,0,0)"
id="g68"><path
d="m 5603.8799,3012.3729 -15.9928,-0.039 -0.9944,-110.4931 23.6693,-0.2001 -6.6821,110.7321 z"
id="path70"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 163.7252,1100.4746 c 1.0258,-0.8183 1.2608,-2.2297 0.5247,-3.1529 -0.7368,-0.9233 -2.1651,-1.0089 -3.191,-0.1908 -1.0256,0.8181 -1.2606,2.2292 -0.5238,3.1524 0.7358,0.9235 2.1642,1.0086 3.1901,0.1913"
id="path72"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.10253,0.1286,-0.14289,0.11392,0,0)"
id="g74"><path
d="m 5852.363,3053.3992 c 0,-7.181 -5.8216,-13.0011 -13.0009,-13.0005 -7.1815,0 -13.0025,5.8227 -13.0013,13.0025 0,7.1796 5.8198,12.9977 13.0013,12.9949 7.1799,0 12.998,-5.8198 13.0009,-12.9969 z"
id="path76"
style="fill:none;stroke:#ffffff;stroke-width:0.2744;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 161.0351,1097.1516 c 0.1474,-0.1171 0.3518,-0.2931 0.4986,-0.4005 0.6089,-0.4496 1.1656,-0.6818 1.7734,-1.0387 1.2781,-0.7894 2.3397,-1.4428 3.1807,-2.232 0.3969,-0.4249 0.3662,-0.8268 0.4008,-1.2104 l 3.8472,1.2453 -8.0047,5.7356 -1.696,-2.0993 z"
id="path78"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.1343,-0.1071,0.11394,0.14288,0,0)"
id="g80"><path
d="m -3249.2299,5243.3232 c 1.0919,-9e-4 2.6612,-0.054 3.7205,-0.014 4.403,0.1539 7.7794,1.0602 11.8417,1.6056 8.6817,0.9844 15.8837,1.8121 22.5768,1.3042 3.3486,-0.4641 4.6681,-2.2882 6.2175,-3.8109 l 12.9912,18.4518 -57.2536,-2.7726 -0.094,-14.7639 z"
id="path82"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 163.6999,1100.4936 c 0.1472,-0.1176 0.3643,-0.278 0.5012,-0.3965 0.574,-0.4944 0.9247,-0.9851 1.4077,-1.4979 1.0548,-1.0709 1.9275,-1.9601 2.8842,-2.6039 0.5026,-0.2928 0.8876,-0.1737 1.2691,-0.1221 l -0.3586,-4.0275 -7.3732,6.5273 1.6696,2.1206 z"
id="path84"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.1343,-0.1071,0.11394,0.14288,0,0)"
id="g86"><path
d="m -3249.2341,5266.7113 c 1.0978,-3e-4 2.6671,0.053 3.7204,0.013 4.4068,-0.1565 7.7837,-1.0596 11.8432,-1.6053 8.6876,-0.983 15.8876,-1.8099 22.5782,-1.2999 3.3503,0.462 4.6704,2.2847 6.2195,3.8072 l 12.9884,-18.4521 -57.2517,2.768 -0.098,14.7688 z"
id="path88"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 163.3717,1067.5885 -0.6052,2.6796 19.6464,4.6636 0.9419,-3.9555 -19.9831,-3.3877 z"
id="path90"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.03823,-0.16747,0.17816,0.04067,0,0)"
id="g92"><path
d="m -5847.3595,2171.5736 -15.992,0.034 -1.017,110.4899 23.669,0.2087 -6.66,-110.7329 z"
id="path94"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 162.3444,1072.0845 0.6182,-2.6767 19.7238,4.3271 -0.8685,3.9719 -19.4735,-5.6223 z"
id="path96"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.03823,-0.16747,0.17816,0.04067,0,0)"
id="g98"><path
d="m -5874.2073,2171.5679 15.9931,0.04 0.9924,110.4916 -23.6673,0.203 6.6818,-110.7349 z"
id="path100"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 154.9497,1070.2236 c 1.2787,0.2928 2.529,-0.4039 2.7921,-1.5551 0.2625,-1.1509 -0.561,-2.3213 -1.8405,-2.6127 -1.2785,-0.2928 -2.5285,0.4039 -2.7919,1.5551 -0.2625,1.1509 0.5613,2.3207 1.8403,2.6127"
id="path102"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.03662,-0.16034,0.17816,0.04069,0,0)"
id="g104"><path
d="m -6133.9467,2130.5761 c 0,7.1782 5.8161,12.9985 12.9991,12.9988 7.1756,-3e-4 12.9985,-5.8192 12.9951,-13.0005 0.01,-7.1753 -5.8189,-12.9966 -12.9988,-12.9988 -7.1773,5e-4 -12.9963,5.8218 -12.9954,13.0005 z"
id="path106"
style="fill:none;stroke:#ffffff;stroke-width:0.2744;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 155.8706,1066.049 c 0.1829,0.042 0.4488,0.093 0.6234,0.14 0.7316,0.1962 1.2606,0.4867 1.9182,0.7387 1.4148,0.508 2.5869,0.9301 3.7281,1.0951 0.58,0.046 0.8745,-0.2282 1.1968,-0.4405 l 1.4247,3.7842 -9.4759,-2.6816 0.5847,-2.6359 z"
id="path108"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.16747,0.03823,-0.04067,0.17816,0,0)"
id="g110"><path
d="m 2265.6285,5497.4356 c 1.0922,0 2.6666,-0.045 3.7177,-0.01 4.4093,0.1534 7.7862,1.0596 11.8448,1.603 8.6851,0.9845 15.8865,1.8117 22.5771,1.3023 3.3483,-0.4592 4.6676,-2.2825 6.2201,-3.8072 l 12.9895,18.4535 -57.2534,-2.7672 -0.096,-14.7744 z"
id="path112"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 154.9191,1070.2165 c 0.1834,0.042 0.4447,0.1106 0.6224,0.1451 0.7447,0.1404 1.3471,0.1078 2.0489,0.1661 1.4947,0.1571 2.7338,0.2849 3.8339,0.6313 0.5428,0.2106 0.6894,0.5859 0.8867,0.9165 l 2.9262,-2.791 -9.701,-1.696 -0.6171,2.628 z"
id="path114"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.16747,0.03823,-0.04067,0.17816,0,0)"
id="g116"><path
d="m 2265.6266,5520.8273 c 1.0955,0 2.6674,0.048 3.7193,0.017 4.4096,-0.1585 7.7859,-1.0659 11.8448,-1.6093 8.6865,-0.9822 15.8843,-1.809 22.5766,-1.3005 3.3536,0.4626 4.6684,2.287 6.2195,3.8092 l 12.9917,-18.4527 -57.2533,2.7683 -0.099,14.7682 z"
id="path118"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 180.4031,1049.4196 -2.473,1.1973 8.6032,18.2685 3.6802,-1.73 -9.8104,-17.7358 z"
id="path120"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.15477,-0.07453,0.07929,0.16465,0,0)"
id="g122"><path
d="m -1704.3131,5602.1797 -15.9959,0.035 -1.0171,110.4913 23.6718,0.2081 -6.6588,-110.7343 z"
id="path124"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 176.2469,1051.4203 2.4784,-1.1858 8.9141,18.1179 -3.6474,1.7978 -7.7451,-18.7299 z"
id="path126"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.15477,-0.07453,0.07929,0.16465,0,0)"
id="g128"><path
d="m -1731.1657,5602.1774 15.9936,0.038 0.9918,110.4882 -23.669,0.2044 6.6836,-110.7309 z"
id="path130"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 173.0911,1044.4779 c 0.5695,1.1824 1.8927,1.7255 2.9568,1.2132 1.0642,-0.5122 1.4653,-1.8858 0.8964,-3.0676 -0.5687,-1.1826 -1.8933,-1.7252 -2.9569,-1.2132 -1.0644,0.5122 -1.4655,1.8856 -0.8963,3.0676"
id="path132"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.14819,-0.07134,0.07926,0.16466,0,0)"
id="g134"><path
d="m -1806.2371,5560.6799 c 3e-4,7.1804 5.821,12.9988 13.0023,13.0011 7.1781,0 12.9974,-5.8221 12.9957,-12.9997 0.01,-7.1801 -5.821,-12.9991 -12.9974,-12.9994 -7.1822,-5e-4 -13.0014,5.819 -13.0006,12.998 z"
id="path136"
style="fill:none;stroke:#ffffff;stroke-width:0.2744;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 176.9292,1042.5954 c 0.0817,0.1695 0.207,0.4085 0.2792,0.5749 0.3033,0.6934 0.4057,1.2883 0.6183,1.9596 0.4853,1.4227 0.8858,2.6025 1.468,3.5974 0.3266,0.4819 0.7249,0.542 1.0908,0.6614 l -2.0698,3.4733 -3.8107,-9.0808 2.4242,-1.1858 z"
id="path138"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.07453,0.15477,-0.16465,0.07929,0,0)"
id="g140"><path
d="m 5915.209,1602.9547 c 1.0953,0 2.6649,-0.05 3.7202,-0.012 4.4056,0.1519 7.7811,1.0601 11.8409,1.605 8.6862,0.9844 15.8865,1.8127 22.5763,1.3028 3.3508,-0.4666 4.6717,-2.2873 6.222,-3.8084 l 12.9909,18.4516 -57.2547,-2.7709 -0.096,-14.7685 z"
id="path142"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 173.0784,1044.4501 c 0.0813,0.169 0.1902,0.4165 0.2744,0.5766 0.354,0.6698 0.7554,1.12 1.1471,1.7059 0.8099,1.266 1.482,2.3145 1.8975,3.3905 0.1735,0.5553 -0.0286,0.904 -0.1644,1.2646 l 4.0071,0.5473 -4.7237,-8.6411 -2.438,1.1562 z"
id="path144"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.07453,0.15477,-0.16465,0.07929,0,0)"
id="g146"><path
d="m 5915.2107,1626.3439 c 1.0917,0 2.6638,0.052 3.7171,0.016 4.4073,-0.1553 7.7822,-1.0655 11.8432,-1.6064 8.6876,-0.9845 15.8853,-1.8102 22.5771,-1.3051 3.3499,0.4646 4.6689,2.2873 6.22,3.8141 l 12.9887,-18.4575 -57.2528,2.7737 -0.093,14.7653 z"
id="path148"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 205.2142,1051.4548 -2.4778,-1.1863 -8.9186,18.1171 3.6467,1.798 7.7497,-18.7288 z"
id="path150"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.15477,0.07454,-0.0793,0.16465,0,0)"
id="g152"><path
d="m 3732.232,4696.5288 -15.992,0.035 -1.0145,110.4942 23.669,0.2069 -6.6625,-110.7357 z"
id="path154"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 201.0589,1049.4533 2.4729,1.1988 -8.6082,18.2661 -3.6797,-1.7314 9.815,-17.7335 z"
id="path156"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.15477,0.07454,-0.0793,0.16465,0,0)"
id="g158"><path
d="m 3705.3822,4696.5274 15.9982,0.038 0.9873,110.4936 -23.6687,0.201 6.6832,-110.7329 z"
id="path160"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 204.5188,1042.6575 c -0.5697,1.1821 -0.1686,2.5563 0.8952,3.0685 1.0636,0.5122 2.3879,-0.03 2.9574,-1.2124 0.5689,-1.182 0.1684,-2.5554 -0.8952,-3.0682 -1.0644,-0.5125 -2.3876,0.031 -2.9574,1.2121"
id="path162"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.14817,0.07138,-0.07932,0.16464,0,0)"
id="g164"><path
d="m 3871.7606,4654.3567 c -9e-4,7.1818 5.8221,13.0025 13.0017,13.0022 7.1767,0 12.9999,-5.8209 12.9991,-13.002 0,-7.1784 -5.8212,-12.9977 -13,-12.9996 -7.183,0 -12.9977,5.8215 -13.0008,12.9994 z"
id="path166"
style="fill:none;stroke:#ffffff;stroke-width:0.2744;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 208.3836,1044.4844 c -0.0811,0.1698 -0.1896,0.4167 -0.2747,0.5775 -0.354,0.6698 -0.7554,1.1199 -1.1472,1.7056 -0.8095,1.2665 -1.4819,2.3142 -1.8978,3.3908 -0.1732,0.5553 0.029,0.9037 0.1636,1.2639 l -4.0059,0.5477 4.7233,-8.6411 2.4387,1.1556 z"
id="path168"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.07454,-0.15477,0.16465,0.0793,0,0)"
id="g170"><path
d="m -4951.7391,3507.378 c -1.097,5e-4 -2.6659,0.055 -3.7224,0.017 -4.4059,-0.1556 -7.7822,-1.065 -11.844,-1.6073 -8.6868,-0.9827 -15.8817,-1.8093 -22.5771,-1.3039 -3.35,0.4646 -4.665,2.2876 -6.2153,3.8089 l -12.992,-18.4507 57.2536,2.7686 0.097,14.7677 z"
id="path172"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 204.5333,1042.6297 c -0.0825,0.1693 -0.2072,0.4091 -0.2801,0.5746 -0.3024,0.6945 -0.405,1.2895 -0.6179,1.9602 -0.4859,1.423 -0.8861,2.6022 -1.4684,3.5983 -0.3265,0.4816 -0.7248,0.5408 -1.091,0.6599 l 2.0701,3.4738 3.8112,-9.0802 -2.4239,-1.1866 z"
id="path174"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.07454,-0.15477,0.16465,0.0793,0,0)"
id="g176"><path
d="m -4951.7379,3483.9904 c -1.0953,0 -2.6683,-0.049 -3.7196,-0.014 -4.4074,0.1565 -7.7871,1.0633 -11.8438,1.6036 -8.687,0.987 -15.8847,1.8128 -22.5799,1.3073 -3.3508,-0.4663 -4.6681,-2.2904 -6.2186,-3.8114 l -12.989,18.4538 57.2508,-2.7706 0.1001,-14.7688 z"
id="path178"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 219.1056,1072.1339 -0.6173,-2.6771 -19.7252,4.3226 0.868,3.9727 19.4745,-5.6182 z"
id="path180"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.03822,0.16747,-0.17816,0.04066,0,0)"
id="g182"><path
d="m 6368.633,136.4414 -15.9914,0.0349 -1.0165,110.4948 23.6699,0.206 -6.662,-110.7357 z"
id="path184"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 218.0798,1067.6375 0.6046,2.6794 -19.6481,4.659 -0.9405,-3.9555 19.984,-3.3829 z"
id="path186"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.03822,0.16747,-0.17816,0.04066,0,0)"
id="g188"><path
d="m 6341.7858,136.44 15.9894,0.0363 0.993,110.4933 -23.6673,0.2019 6.6849,-110.7315 z"
id="path190"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 225.5496,1066.1054 c -1.279,0.2923 -2.103,1.4613 -1.8405,2.6127 0.2631,1.1517 1.5126,1.8479 2.7913,1.5562 1.2793,-0.2914 2.1036,-1.4609 1.8411,-2.6127 -0.2631,-1.1514 -1.5123,-1.8482 -2.7919,-1.5562"
id="path192"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.03657,0.16035,-0.17817,0.04063,0,0)"
id="g194"><path
d="m 6624.6812,93.8699 c 0,7.1821 5.8189,12.9977 13.0011,12.9988 7.1796,-0.003 12.9974,-5.8215 12.9971,-12.9986 0,-7.1795 -5.8161,-13.0019 -12.9985,-13.0013 -7.1813,0.0022 -13.0012,5.8223 -12.9997,13.0011 z"
id="path196"
style="fill:none;stroke:#ffffff;stroke-width:0.2744;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 226.531,1070.2664 c -0.1826,0.042 -0.4439,0.1105 -0.6225,0.1443 -0.7435,0.1411 -1.3462,0.1085 -2.048,0.1669 -1.4947,0.1562 -2.7346,0.2844 -3.8345,0.6305 -0.5422,0.2103 -0.6891,0.5862 -0.8869,0.9164 l -2.9251,-2.7918 9.7005,-1.6937 0.6165,2.6274 z"
id="path198"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.16748,-0.03822,0.04066,0.17817,0,0)"
id="g200"><path
d="m -100.5092,5985.5941 c -1.0916,-2e-4 -2.6645,0.05 -3.7196,0.012 -4.4028,-0.1522 -7.7808,-1.0598 -11.8414,-1.6029 -8.684,-0.9862 -15.8879,-1.8139 -22.5803,-1.3054 -3.3477,0.4654 -4.6655,2.2895 -6.2161,3.8103 l -12.9872,-18.4544 57.2485,2.7726 0.0961,14.7679 z"
id="path202"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 225.5803,1066.0992 c -0.1834,0.042 -0.4485,0.093 -0.624,0.14 -0.731,0.1953 -1.26,0.4859 -1.9176,0.7379 -1.4148,0.5074 -2.5869,0.93 -3.7281,1.0953 -0.5794,0.046 -0.8754,-0.2288 -1.1965,-0.4405 l -1.4247,3.7839 9.4748,-2.6821 -0.5839,-2.6345 z"
id="path204"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.16748,-0.03822,0.04066,0.17817,0,0)"
id="g206"><path
d="m -100.5077,5962.2049 c -1.0954,6e-4 -2.6652,-0.052 -3.7225,-0.013 -4.4022,0.1536 -7.7803,1.0581 -11.8358,1.6027 -8.6899,0.9836 -15.8896,1.8116 -22.5808,1.3036 -3.3505,-0.4626 -4.6715,-2.2858 -6.22,-3.8066 l -12.9867,18.4527 57.2477,-2.7737 0.0981,-14.766 z"
id="path208"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 211.6429,1095.893 1.7084,-2.1515 -15.6779,-12.7267 -2.5639,3.1547 16.5334,11.7235 z"
id="path210"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.10711,-0.1343,0.14287,0.11395,0,0)"
id="g212"><path
d="m -4219.3791,4644.5956 15.993,-0.032 1.012,-110.4928 -23.6625,-0.208 6.6575,110.7329 z"
id="path214"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 214.52,1092.2873 -1.7192,2.1436 -15.8913,-12.4566 2.5053,-3.2014 15.1052,13.5144 z"
id="path216"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.10711,-0.1343,0.14287,0.11395,0,0)"
id="g218"><path
d="m -4192.5257,4644.6018 -15.9959,-0.041 -0.9899,-110.4863 23.6639,-0.2055 -6.6781,110.7329 z"
id="path220"
style="fill:none;stroke:#ffffff;stroke-width:0.41159999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 220.3747,1097.1729 c -1.0256,-0.8181 -2.4542,-0.7331 -3.1901,0.1902 -0.7364,0.9229 -0.5017,2.3349 0.5233,3.1529 1.0261,0.8181 2.4542,0.7331 3.1909,-0.1899 0.7359,-0.923 0.5018,-2.3352 -0.5241,-3.1532"
id="path222"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.10257,-0.12857,0.14286,0.11397,0,0)"
id="g224"><path
d="m -4379.2058,4686.834 c -3e-4,-7.1787 -5.8215,-12.9999 -13,-12.9971 -7.179,-6e-4 -13,5.8218 -13.0017,12.998 0,7.1813 5.8204,13.0011 13.0009,13.0005 7.1778,-5e-4 13.0022,-5.8192 13.0008,-13.0014 z"
id="path226"
style="fill:none;stroke:#ffffff;stroke-width:0.2744;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 217.7337,1100.5347 c -0.1471,-0.1173 -0.364,-0.2786 -0.5012,-0.3962 -0.5737,-0.4938 -0.9241,-0.9859 -1.4068,-1.4976 -1.0554,-1.0718 -1.9273,-1.9613 -2.8843,-2.6053 -0.5026,-0.2925 -0.8872,-0.1735 -1.2691,-0.1216 l 0.3586,-4.028 7.3724,6.5284 -1.6696,2.1203 z"
id="path228"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.1343,0.10711,-0.11395,0.14287,0,0)"
id="g230"><path
d="m 4985.5978,3965.3263 c -1.097,8e-4 -2.6683,0.052 -3.7208,0.016 -4.4036,-0.1551 -7.7842,-1.0647 -11.8383,-1.6067 -8.6933,-0.9845 -15.8919,-1.8139 -22.5811,-1.3048 -3.3517,0.4632 -4.6689,2.2839 -6.2198,3.8098 l -12.9886,-18.4561 57.2496,2.7757 0.099,14.7665 z"
id="path232"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 220.3994,1097.193 c -0.1474,-0.1171 -0.3532,-0.2926 -0.4984,-0.4006 -0.6088,-0.4498 -1.1664,-0.6814 -1.7733,-1.0391 -1.2784,-0.7898 -2.34,-1.4429 -3.1811,-2.2323 -0.3968,-0.4247 -0.3662,-0.8266 -0.4008,-1.2101 l -3.8472,1.2452 8.0045,5.7362 1.6963,-2.0993 z"
id="path234"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><g
transform="matrix(0.1343,0.10711,-0.11395,0.14287,0,0)"
id="g236"><path
d="m 4985.5986,3941.9357 c -1.0956,0 -2.6665,-0.048 -3.7216,-0.013 -4.4042,0.1528 -7.7836,1.0656 -11.8429,1.6047 -8.6839,0.9848 -15.887,1.8114 -22.5788,1.3028 -3.3499,-0.4629 -4.6672,-2.2867 -6.2169,-3.8072 l -12.9903,18.4524 57.2507,-2.7706 0.1,-14.7687 z"
id="path238"
style="fill:none;stroke:#ffffff;stroke-width:0.26840001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><path
d="m 187.367,1086.9849 c -0.0426,-1.0035 -0.868,-1.8049 -1.8822,-1.8049 -0.4156,0 -0.7988,0.1338 -1.1101,0.3606 l -0.489,-0.2324 1.0012,-2.0696 4.3855,2.1152 -0.9958,2.0693 -0.9096,-0.4382 z"
id="path240"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 180.2086,1080.3039 c 0.7586,-0.6588 0.8697,-1.8043 0.2379,-2.5971 -0.2591,-0.3243 -0.603,-0.5409 -0.9746,-0.6429 l -0.1227,-0.5276 2.2419,-0.5076 1.0811,4.7477 -2.2393,0.5119 -0.2243,-0.9844 z"
id="path242"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 180.9609,1070.5462 c 0.9874,0.182 1.9525,-0.4448 2.1782,-1.4335 0.0927,-0.4045 0.0476,-0.8087 -0.1052,-1.1628 l 0.3365,-0.4243 1.7952,1.4357 -3.039,3.805 -1.7958,-1.4315 0.6301,-0.7886 z"
id="path244"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 189.059,1065.0538 c 0.4731,0.8861 1.5653,1.2495 2.4786,0.8095 0.3739,-0.1797 0.6613,-0.4665 0.8438,-0.8064 l 0.5415,0 -0.004,2.2986 -4.8699,0 0,-2.2975 1.0097,6e-4 z"
id="path246"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 198.3934,1067.993 c -0.3971,0.9233 -8e-4,2.003 0.9131,2.4426 0.3739,0.1809 0.777,0.2262 1.1562,0.1562 l 0.3391,0.4227 -1.7989,1.4309 -3.0339,-3.8095 1.7954,-1.4326 0.629,0.7897 z"
id="path248"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 201.9577,1077.1194 c -0.9688,0.2648 -1.5661,1.2481 -1.3408,2.2366 0.0922,0.4045 0.3079,0.7489 0.5987,1.0023 l -0.1182,0.5284 -2.2399,-0.5148 1.0862,-4.7472 2.2394,0.5103 -0.2254,0.9844 z"
id="path250"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 197.0442,1085.5809 c -0.811,-0.5922 -1.9525,-0.4462 -2.5844,0.3469 -0.2588,0.324 -0.394,0.7073 -0.4104,1.0928 l -0.4868,0.2369 -0.9935,-2.0726 4.388,-2.1104 0.9975,2.0695 -0.9104,0.4369 z"
id="path252"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 281.6892,1072.3652 c 0.7671,0.8949 1.5449,1.8431 2.3332,2.8442 0.7883,1.0015 1.5554,2.035 2.3012,3.1003 0.7458,1.0653 1.4595,2.0988 2.1413,3.1003 0.682,1.0014 1.2784,1.9496 1.7898,2.8445 l 9.4603,0 c -0.767,-0.9802 -1.6407,-2.0455 -2.6206,-3.196 -0.9802,-1.1506 -1.9922,-2.3228 -3.0365,-3.5159 -1.044,-1.1931 -2.088,-2.3436 -3.132,-3.4517 -1.044,-1.1078 -1.9922,-2.1305 -2.8445,-3.0682 1.0655,-1.0228 2.2161,-2.2479 3.4517,-3.6754 1.2359,-1.4276 2.4503,-2.9084 3.6437,-4.4425 1.1931,-1.5341 2.2903,-3.0682 3.2918,-4.6023 1.0015,-1.5341 1.8003,-2.8979 2.397,-4.091 l -9.0127,0 c -0.5114,1.0653 -1.1827,2.2692 -2.0138,3.6116 -0.8308,1.3423 -1.7149,2.6632 -2.6526,3.9632 -0.9375,1.2997 -1.8856,2.5353 -2.8443,3.7074 -0.959,1.1718 -1.8431,2.1413 -2.653,2.9083 l 0,-14.1905 -7.9262,0 0,43.0189 7.9262,1.3422 0,-26.2074 z"
id="path254"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 329.694,1055.2343 c -1.4491,-0.3836 -3.2069,-0.7671 -5.2736,-1.1506 -2.0668,-0.3835 -4.3146,-0.5752 -6.7436,-0.5752 -2.4719,0 -4.4958,0.3408 -6.0727,1.0225 -1.5766,0.682 -2.823,1.6515 -3.7392,2.9086 -0.9161,1.2572 -1.5449,2.738 -1.8859,4.4425 -0.3407,1.7045 -0.5113,3.5796 -0.5113,5.625 l 0,16.7474 7.8624,0 0,-15.7246 c 0,-2.77 0.3302,-4.826 0.9907,-6.1685 0.6605,-1.3422 1.9497,-2.0134 3.8673,-2.0134 1.1931,0 2.3862,0.1066 3.5796,0.3194 l 0,23.5871 7.9263,0 0,-29.0202 z"
id="path256"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 355.7095,1069.4248 c 0,2.8125 -0.4581,4.9646 -1.3743,6.4559 -0.9161,1.4916 -2.3119,2.2374 -4.1867,2.2374 -0.8524,0 -1.694,-0.1174 -2.5248,-0.3518 -0.8312,-0.2341 -1.5449,-0.5219 -2.1416,-0.8629 l 0,-16.2997 c 0.5967,-0.1279 1.2251,-0.2132 1.8859,-0.2557 0.6604,-0.043 1.2251,-0.064 1.6937,-0.064 2.0454,0 3.6649,0.6925 4.858,2.0775 1.1931,1.385 1.7898,3.7395 1.7898,7.0634 z m 7.9903,-0.1919 c 0,-2.3862 -0.3198,-4.5491 -0.959,-6.488 -0.6392,-1.9389 -1.5766,-3.59 -2.8125,-4.9538 -1.2359,-1.3637 -2.7485,-2.4182 -4.5383,-3.164 -1.7898,-0.7458 -3.8353,-1.1186 -6.1364,-1.1186 -2.0455,0 -4.1338,0.1491 -6.2643,0.4473 -2.1308,0.2982 -3.9206,0.6818 -5.3694,1.1506 l 0,42.124 7.8622,1.3422 0,-15.0214 c 1.108,0.5114 2.1733,0.8629 3.196,1.0548 1.0228,0.1916 2.0455,0.2877 3.0683,0.2877 1.9604,0 3.6861,-0.373 5.1777,-1.1188 1.4913,-0.7458 2.738,-1.8111 3.7392,-3.1961 1.0015,-1.3847 1.7581,-3.0362 2.2694,-4.9538 0.5114,-1.9176 0.7671,-4.0481 0.7671,-6.3921"
id="path258"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 367.5986,1068.9772 c 0,2.6422 0.405,4.9646 1.2146,6.9676 0.8096,2.0026 1.8751,3.6754 3.1961,5.0176 1.3209,1.3425 2.8338,2.3544 4.5382,3.0364 1.7048,0.6818 3.4518,1.0228 5.2416,1.0228 4.4319,0 7.7984,-1.3105 10.0995,-3.9314 2.3012,-2.6206 3.4518,-6.4451 3.4518,-11.4738 0,-0.5114 -0.0108,-1.044 -0.0321,-1.5979 -0.0212,-0.5542 -0.0532,-1.0015 -0.0958,-1.3425 l -19.4958,0 c 0,-1.9601 0.8096,-3.505 2.429,-4.634 1.6192,-1.1294 3.7074,-1.694 6.2643,-1.694 1.5766,0 3.0787,0.1703 4.5062,0.5113 1.4278,0.341 2.6314,0.6818 3.6116,1.0228 l 1.0868,-6.7119 c -1.3637,-0.4686 -2.8125,-0.8629 -4.3466,-1.1823 -1.5341,-0.3198 -3.2601,-0.4794 -5.1778,-0.4794 -2.5568,0 -4.8472,0.3303 -6.8714,0.9907 -2.0242,0.6605 -3.75,1.6407 -5.1775,2.9404 -1.4275,1.2997 -2.5251,2.9084 -3.2922,4.826 -0.767,1.9176 -1.1505,4.1547 -1.1505,6.7116 z m 20.1353,3.1323 c 0,0.8096 -0.1066,1.5874 -0.3198,2.3329 -0.2131,0.7458 -0.5538,1.417 -1.0227,2.0137 -0.4686,0.5964 -1.0653,1.0761 -1.7898,1.438 -0.7242,0.3623 -1.6191,0.5434 -2.6847,0.5434 -1.0227,0 -1.9069,-0.1703 -2.6526,-0.5113 -0.7458,-0.341 -1.3638,-0.8096 -1.8536,-1.4063 -0.4901,-0.5967 -0.8737,-1.2784 -1.1506,-2.0455 -0.2772,-0.767 -0.4581,-1.5553 -0.5434,-2.3649 l 12.0172,0 z"
id="path260"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 425.5109,1076.2642 c -0.5113,0.1279 -1.1185,0.2557 -1.8218,0.3835 -0.703,0.1279 -1.4168,0.2452 -2.1413,0.3515 -0.7245,0.1066 -1.4275,0.1812 -2.1092,0.224 -0.6821,0.043 -1.2572,0.064 -1.7261,0.064 -1.1077,0 -2.1945,-0.053 -3.2598,-0.1599 -1.0656,-0.1063 -2.1521,-0.309 -3.2601,-0.6072 l 0,-22.3084 -7.9263,0 0,28.0613 c 2.0883,0.7671 4.2296,1.385 6.4242,1.8539 2.1946,0.4685 4.7622,0.703 7.7026,0.703 0.426,0 1.0332,-0.021 1.8215,-0.064 0.7886,-0.043 1.6302,-0.1174 2.5251,-0.2239 0.8949,-0.1066 1.8003,-0.2345 2.7165,-0.3836 0.9161,-0.1491 1.7365,-0.3515 2.461,-0.6072 l -1.4063,-7.287 z"
id="path262"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 433.5647,1083.2956 c 1.4063,0.3835 3.1428,0.7458 5.2098,1.0868 2.0668,0.3407 4.3146,0.5113 6.7436,0.5113 2.3862,0 4.3679,-0.3305 5.9446,-0.991 1.5766,-0.6604 2.8233,-1.5978 3.7394,-2.8125 0.9162,-1.2144 1.5662,-2.6631 1.9497,-4.3466 0.3835,-1.6833 0.5752,-3.5476 0.5752,-5.5931 l 0,-16.939 -7.8622,0 0,15.9163 c 0,2.8125 -0.3198,4.8367 -0.959,6.0726 -0.6392,1.2357 -1.9389,1.8536 -3.899,1.8536 -0.5967,0 -1.1826,-0.021 -1.7578,-0.064 -0.5754,-0.043 -1.1826,-0.1065 -1.8218,-0.1919 l 0,-23.5868 -7.8625,0 0,29.0841 z"
id="path264"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 463.4796,1068.9772 c 0,2.6422 0.4051,4.9646 1.2146,6.9676 0.8096,2.0026 1.8752,3.6754 3.1961,5.0176 1.3209,1.3425 2.8338,2.3544 4.5383,3.0364 1.7047,0.6818 3.4517,1.0228 5.2415,1.0228 4.432,0 7.7984,-1.3105 10.0996,-3.9314 2.3011,-2.6206 3.4517,-6.4451 3.4517,-11.4738 0,-0.5114 -0.0108,-1.044 -0.032,-1.5979 -0.0213,-0.5542 -0.0533,-1.0015 -0.0958,-1.3425 l -19.4959,0 c 0,-1.9601 0.8096,-3.505 2.429,-4.634 1.6192,-1.1294 3.7075,-1.694 6.2643,-1.694 1.5767,0 3.0787,0.1703 4.5063,0.5113 1.4278,0.341 2.6314,0.6818 3.6116,1.0228 l 1.0868,-6.7119 c -1.3638,-0.4686 -2.8126,-0.8629 -4.3467,-1.1823 -1.5341,-0.3198 -3.2601,-0.4794 -5.1777,-0.4794 -2.5569,0 -4.8473,0.3303 -6.8715,0.9907 -2.0242,0.6605 -3.7499,1.6407 -5.1775,2.9404 -1.4275,1.2997 -2.5251,2.9084 -3.2921,4.826 -0.7671,1.9176 -1.1506,4.1547 -1.1506,6.7116 z m 20.1353,3.1323 c 0,0.8096 -0.1066,1.5874 -0.3197,2.3329 -0.2132,0.7458 -0.5539,1.417 -1.0228,2.0137 -0.4685,0.5964 -1.0652,1.0761 -1.7898,1.438 -0.7242,0.3623 -1.6191,0.5434 -2.6846,0.5434 -1.0228,0 -1.9069,-0.1703 -2.6527,-0.5113 -0.7458,-0.341 -1.3638,-0.8096 -1.8536,-1.4063 -0.4901,-0.5967 -0.8736,-1.2784 -1.1506,-2.0455 -0.2772,-0.767 -0.458,-1.5553 -0.5434,-2.3649 l 12.0172,0 z"
id="path266"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 502.5991,1077.7346 -6.8394,0 0,6.5199 6.8394,0 0,7.5424 7.8625,1.2785 0,-8.8209 12.5923,0 0,-6.5199 -12.5923,0 0,-12.1451 c 0,-1.1081 0.1066,-2.0029 0.3194,-2.6847 0.2132,-0.6817 0.5114,-1.2146 0.8949,-1.5982 0.3836,-0.3835 0.8524,-0.6392 1.4063,-0.767 0.5542,-0.1279 1.1718,-0.1916 1.8539,-0.1916 0.7242,0 1.3955,0.021 2.0134,0.064 0.618,0.043 1.2144,0.1174 1.7898,0.224 0.5752,0.1063 1.1718,0.2662 1.7898,0.4793 0.618,0.2132 1.2889,0.4901 2.0135,0.8309 l 1.0868,-6.7757 c -1.4491,-0.5964 -3.0153,-1.0225 -4.6985,-1.2781 -1.6832,-0.2557 -3.3131,-0.3836 -4.8897,-0.3836 -1.8326,0 -3.4518,0.1491 -4.8581,0.4473 -1.4062,0.2982 -2.5996,0.8737 -3.5795,1.7258 -0.9803,0.8524 -1.7261,2.0562 -2.2374,3.6116 -0.5114,1.5554 -0.7671,3.5904 -0.7671,6.1044 l 0,12.337 z"
id="path268"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 527.4003,1068.9772 c 0,2.6422 0.4051,4.9646 1.2146,6.9676 0.8096,2.0026 1.8751,3.6754 3.1961,5.0176 1.3209,1.3425 2.8338,2.3544 4.5383,3.0364 1.7047,0.6818 3.4517,1.0228 5.2415,1.0228 4.432,0 7.7984,-1.3105 10.0996,-3.9314 2.3011,-2.6206 3.4517,-6.4451 3.4517,-11.4738 0,-0.5114 -0.0108,-1.044 -0.032,-1.5979 -0.0213,-0.5542 -0.0533,-1.0015 -0.0958,-1.3425 l -19.4959,0 c 0,-1.9601 0.8096,-3.505 2.429,-4.634 1.6192,-1.1294 3.7075,-1.694 6.2643,-1.694 1.5766,0 3.0787,0.1703 4.5063,0.5113 1.4278,0.341 2.6314,0.6818 3.6116,1.0228 l 1.0868,-6.7119 c -1.3638,-0.4686 -2.8126,-0.8629 -4.3467,-1.1823 -1.5341,-0.3198 -3.2601,-0.4794 -5.1777,-0.4794 -2.5569,0 -4.8473,0.3303 -6.8715,0.9907 -2.0242,0.6605 -3.7499,1.6407 -5.1775,2.9404 -1.4275,1.2997 -2.5251,2.9084 -3.2921,4.826 -0.7671,1.9176 -1.1506,4.1547 -1.1506,6.7116 z m 20.1353,3.1323 c 0,0.8096 -0.1066,1.5874 -0.3197,2.3329 -0.2132,0.7458 -0.5539,1.417 -1.0228,2.0137 -0.4685,0.5964 -1.0652,1.0761 -1.7898,1.438 -0.7242,0.3623 -1.6191,0.5434 -2.6847,0.5434 -1.0227,0 -1.9068,-0.1703 -2.6526,-0.5113 -0.7458,-0.341 -1.3638,-0.8096 -1.8536,-1.4063 -0.4901,-0.5967 -0.8736,-1.2784 -1.1506,-2.0455 -0.2772,-0.767 -0.4581,-1.5553 -0.5434,-2.3649 l 12.0172,0 z"
id="path270"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /><path
d="m 571.9533,1060.1561 c 1.9176,0 3.3876,0.1386 4.4104,0.4155 1.0227,0.277 1.5341,0.8416 1.5341,1.694 0,0.5539 -0.1599,1.0227 -0.4793,1.4063 -0.3198,0.3835 -0.7671,0.7137 -1.3425,0.9907 -0.5752,0.2769 -1.2357,0.5434 -1.9814,0.7991 -0.7458,0.2557 -1.5234,0.5113 -2.3332,0.767 -1.1506,0.3407 -2.3225,0.735 -3.5156,1.1826 -1.1931,0.4473 -2.2799,1.012 -3.2601,1.6937 -0.9799,0.6821 -1.7898,1.5449 -2.429,2.5889 -0.6392,1.044 -0.9587,2.3545 -0.9587,3.9311 0,1.2784 0.2449,2.4823 0.735,3.6116 0.4901,1.1294 1.2572,2.1305 2.3012,3.0042 1.044,0.8736 2.3757,1.5554 3.9952,2.0455 1.6191,0.4901 3.5583,0.7353 5.8166,0.7353 1.9605,0 3.782,-0.1494 5.4652,-0.4476 1.6835,-0.2982 3.1428,-0.7246 4.3787,-1.2784 l -1.2143,-6.6479 c -0.7246,0.2132 -1.8539,0.5647 -3.388,1.0548 -1.5341,0.4901 -3.2599,0.735 -5.1775,0.735 -2.003,0 -3.3559,-0.2449 -4.0589,-0.735 -0.7033,-0.4901 -1.0548,-1.0122 -1.0548,-1.5661 0,-0.4689 0.1599,-0.8841 0.4793,-1.2464 0.3198,-0.3623 0.7458,-0.6925 1.2785,-0.9907 0.5326,-0.2985 1.1506,-0.5859 1.8538,-0.8632 0.703,-0.2769 1.4593,-0.5431 2.2692,-0.7988 1.1505,-0.3835 2.3437,-0.8098 3.5796,-1.2784 1.2356,-0.4689 2.3544,-1.0548 3.3556,-1.7578 1.0015,-0.7032 1.8218,-1.5981 2.461,-2.6847 0.6393,-1.0868 0.959,-2.4185 0.959,-3.9951 0,-1.2359 -0.2344,-2.4078 -0.7033,-3.5158 -0.4688,-1.1078 -1.2464,-2.0668 -2.3332,-2.8763 -1.0865,-0.8096 -2.5035,-1.4488 -4.2505,-1.9177 -1.7473,-0.4688 -3.8994,-0.703 -6.4562,-0.703 -2.5994,0 -4.8152,0.2982 -6.6478,0.8946 -1.8323,0.5967 -3.3024,1.1294 -4.4104,1.5982 l 1.2143,6.5838 c 1.4916,-0.5964 3.079,-1.1506 4.7622,-1.662 1.6832,-0.5114 3.3985,-0.767 5.1458,-0.767"
id="path272"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" /></g></svg>

After

Width:  |  Height:  |  Size: 41 KiB

BIN
_images/marathon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
_images/mesos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
_images/network.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
_images/swarm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
_images/virtualization.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,12 @@
{% extends template.self %}
{% block head %}
{{ super() }}
<style>
@media only screen and (max-width: 640px) {
.book-header .btn[aria-label="github"] {
display: none;
}
}
</style>
{% endblock %}

49
_local/.bashrc_docker Normal file
View File

@@ -0,0 +1,49 @@
# Some useful commands to use docker.
# Author: yeasy@github
# Created:2014-09-25
alias docker-pid="sudo docker inspect --format '{{.State.Pid}}'"
alias docker-ip="sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
#the implementation refs from https://github.com/jpetazzo/nsenter/blob/master/docker-enter
function docker-enter() {
#if [ -e $(dirname "$0")/nsenter ]; then
#Change for centos bash running
if [ -e $(dirname '$0')/nsenter ]; then
# with boot2docker, nsenter is not in the PATH but it is in the same folder
NSENTER=$(dirname "$0")/nsenter
else
# if nsenter has already been installed with path notified, here will be clarified
NSENTER=$(which nsenter)
#NSENTER=nsenter
fi
[ -z "$NSENTER" ] && echo "WARN Cannot find nsenter" && return
if [ -z "$1" ]; then
echo "Usage: `basename "$0"` CONTAINER [COMMAND [ARG]...]"
echo ""
echo "Enters the Docker CONTAINER and executes the specified COMMAND."
echo "If COMMAND is not specified, runs an interactive shell in CONTAINER."
else
PID=$(sudo docker inspect --format "{{.State.Pid}}" "$1")
if [ -z "$PID" ]; then
echo "WARN Cannot find the given container"
return
fi
shift
OPTS="--target $PID --mount --uts --ipc --net --pid"
if [ -z "$1" ]; then
# No command given.
# Use su to clear all host environment variables except for TERM,
# initialize the environment variables HOME, SHELL, USER, LOGNAME, PATH,
# and start a login shell.
#sudo $NSENTER "$OPTS" su - root
sudo $NSENTER --target $PID --mount --uts --ipc --net --pid su - root
else
# Use env to clear all host environment variables.
sudo $NSENTER --target $PID --mount --uts --ipc --net --pid env -i $@
fi
fi
}

Binary file not shown.

13
_local/pull_all.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
# This script will update all local images
# See: https://github.com/yeasy/docker_practice/blob/master/_local/pull_all.sh
# Usage: pull_all
# Author: yeasy@github
# Create: 2014-09-23
for image in `sudo docker images|grep -v "REPOSITORY"|grep -v "<none>"|awk '{print $1":"$2}'`
do
sudo docker pull $image
done

12
_local/push_all.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
# This script will upload all local images to a registry server ($registry is the default value).
# This script requires the push_images, which can be found at https://github.com/yeasy/docker_practice/blob/master/_local/push_images.sh
# Usage: push_all
# Author: yeasy@github
# Create: 2014-09-23
for image in `sudo docker images|grep -v "REPOSITORY"|grep -v "<none>"|awk '{print $1":"$2}'`
do
push_images $image
done

47
_local/push_images.sh Normal file
View File

@@ -0,0 +1,47 @@
#!/bin/sh
# This script will upload the given local images to a registry server ($registry is the default value).
# See: https://github.com/yeasy/docker_practice/blob/master/_local/push_images.sh
# Usage: push_images image1 [image2...]
# Author: yeasy@github
# Create: 2014-09-23
#The registry server address where you want push the images into
registry=127.0.0.1:5000
### DO NOT MODIFY THE FOLLOWING PART, UNLESS YOU KNOW WHAT IT MEANS ###
echo_r () {
[ $# -ne 1 ] && return 0
echo -e "\033[31m$1\033[0m"
}
echo_g () {
[ $# -ne 1 ] && return 0
echo -e "\033[32m$1\033[0m"
}
echo_y () {
[ $# -ne 1 ] && return 0
echo -e "\033[33m$1\033[0m"
}
echo_b () {
[ $# -ne 1 ] && return 0
echo -e "\033[34m$1\033[0m"
}
usage() {
sudo docker images
echo "Usage: $0 registry1:tag1 [registry2:tag2...]"
}
[ $# -lt 1 ] && usage && exit
echo_b "The registry server is $registry"
for image in "$@"
do
echo_b "Uploading $image..."
sudo docker tag $image $registry/$image
sudo docker push $registry/$image
sudo docker rmi $registry/$image
echo_g "Done"
done

View File

@@ -1,9 +1,12 @@
#docker高级网络配置
当docker启动时会在主机上创建一个docker0的虚拟网卡。他随机挑选RFC1918私有网络中的一段地址给docker0。比如172.17.42.1/16,16位掩码的网段可以拥有65534个地址可以使用这对主机和容器来说应该足够了
注意本章介绍docker的高级网络配置一般情况下你不需要知道这些也可以使docker正常工作。简单的网络配置和介绍请看第五章内容。
docker0 不是普通的网卡他是桥接到其他网卡的虚拟网卡容器使用它来和主机相互通信。当创建一个docker容器的时候它就创建了一个对接口当数据包发送到一个接口时另外一个接口也可以收到相同的数据包它们是绑在一起的一对孪生接口。这对接口在容器中那一端的的名字是eth0宿主主机端的会指定一个唯一的名字比如vethAQI2QT这样的名字这种接口名字不再主机的命名空间中。所有的veth*的接口都会桥接到docker0这样docker就创建了在主机和所有容器之间一个虚拟共享网络。
# 高级网络配置
本章将介绍 Docker 的一些高级网络配置和选项
当 Docker 启动时,会自动在主机上创建一个 `docker0` 虚拟网桥,实际上是 Linux 的一个 bridge可以理解为一个软件交换机。它会在挂载到它的网口之间进行转发。
![Docker网络](../images/docker0.png)
同时,Docker 随机分配一个本地未占用的私有网段(在 [RFC1918](http://tools.ietf.org/html/rfc1918) 中定义)中的一个地址给 `docker0` 接口。比如典型的 `172.17.42.1`,掩码为 `255.255.0.0`。此后启动的容器内的网口也会自动分配一个同一网段(`172.17.0.0/16`)的地址。
接下来的部分将介绍在一些场景中docker所有的网络定制配置。linux的原生命令将调整、补充、甚至替换docker默认的网络配置
当创建一个 Docker 容器的时候,同时会创建了一对 `veth pair` 接口(当数据包发送到一个接口时,另外一个接口也可以收到相同的数据包)。这对接口一端在容器内,即 `eth0`;另一端在本地并被挂载到 `docker0` 网桥,名称以 `veth` 开头(例如 `vethAQI2QT`。通过这种方式主机可以跟容器通信容器之间也可以相互通信。Docker 就创建了在主机和所有容器之间一个虚拟共享网络
![Docker 网络](../_images/network.png)
接下来的部分将介绍在一些场景中Docker 所有的网络定制配置。以及通过 Linux 命令来调整、补充、甚至替换 Docker 默认的网络配置。

View File

@@ -0,0 +1,55 @@
## 容器访问控制
容器的访问控制,主要通过 Linux 上的 `iptables` 防火墙来进行管理和实现。`iptables` 是 Linux 上默认的防火墙软件,在大部分发行版中都自带。
### 容器访问外部网络
容器要想访问外部网络需要本地系统的转发支持。在Linux 系统中,检查转发是否打开。
```
$sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
```
如果为 0说明没有开启转发则需要手动打开。
```
$sysctl -w net.ipv4.ip_forward=1
```
如果在启动 Docker 服务的时候设定 `--ip-forward=true`, Docker 就会自动设定系统的 `ip_forward` 参数为 1。
### 容器之间访问
容器之间相互访问,需要两方面的支持。
* 容器的网络拓扑是否已经互联。默认情况下,所有容器都会被连接到 `docker0` 网桥上。
* 本地系统的防火墙软件 -- `iptables` 是否允许通过。
#### 访问所有端口
当启动 Docker 服务时候,默认会添加一条转发策略到 iptables 的 FORWARD 链上。策略为通过(`ACCEPT`)还是禁止(`DROP`)取决于配置`--icc=true`(缺省值)还是 `--icc=false`。当然,如果手动指定 `--iptables=false` 则不会添加 `iptables` 规则。
可见,默认情况下,不同容器之间是允许网络互通的。如果为了安全考虑,可以在 `/etc/default/docker` 文件中配置 `DOCKER_OPTS=--icc=false` 来禁止它。
#### 访问指定端口
在通过 `-icc=false` 关闭网络访问后,还可以通过 `--link=CONTAINER_NAME:ALIAS` 选项来访问容器的开放端口。
例如,在启动 Docker 服务时,可以同时使用 `icc=false --iptables=true` 参数来关闭允许相互的网络访问,并让 Docker 可以修改系统中的 `iptables` 规则。
此时,系统中的 `iptables` 规则可能是类似
```
$ sudo iptables -nL
...
Chain FORWARD (policy ACCEPT)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0
...
```
之后,启动容器(`docker run`)时使用 `--link=CONTAINER_NAME:ALIAS` 选项。Docker 会在 `iptable` 中为 两个容器分别添加一条 `ACCEPT` 规则,允许相互访问开放的端口(取决于 Dockerfile 中的 EXPOSE 行)。
当添加了 `--link=CONTAINER_NAME:ALIAS` 选项后,添加了 `iptables` 规则。
```
$ sudo iptables -nL
...
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 172.17.0.2 172.17.0.3 tcp spt:80
ACCEPT tcp -- 172.17.0.3 172.17.0.2 tcp dpt:80
DROP all -- 0.0.0.0/0 0.0.0.0/0
```
注意:`--link=CONTAINER_NAME:ALIAS` 中的 `CONTAINER_NAME` 目前必须是 Docker 分配的名字,或使用 `--name` 参数指定的名字。主机名则不会被识别。

View File

@@ -1,31 +1,34 @@
##创建自己的桥接
如果希望完全使用自己的桥接设置可以在启动docker服务的时候使用 -b BRIDGE or --bridge=BRIDGE 来告诉docker使用你的网桥。如果服务已经启动旧的网桥还在使用中那需要先停止服务再删除旧的网桥
## 自定义网桥
除了默认的 `docker0` 网桥,用户也可以指定网桥来连接各个容器。
在启动 Docker 服务的时候,使用 `-b BRIDGE``--bridge=BRIDGE` 来指定使用的网桥。
如果服务已经运行,那需要先停止服务,并删除旧的网桥。
```
#停止旧网桥并删除
$ sudo service docker stop
$ sudo ip link set dev docker0 down
$ sudo brctl delbr docker0
```
然后在开启服务前,创建你自己希望的网桥接口,这里建立一个网桥的配置:
然后创建一个网桥 `bridge0`
```
# 创建自己的网桥
$ sudo brctl addbr bridge0
$ sudo ip addr add 192.168.5.1/24 dev bridge0
$ sudo ip link set dev bridge0 up
```
查看确认网桥创建并启动。
```
# 确认网桥启动
$ ip addr show bridge0
4: bridge0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state UP group default
link/ether 66:38:d0:0d:76:18 brd ff:ff:ff:ff:ff:ff
inet 192.168.5.1/24 scope global bridge0
valid_lft forever preferred_lft forever
```
配置 Docker 服务,默认桥接到创建的网桥上。
```
# 告诉docker桥接设置并启动docker服务在ubuntu上
$ echo 'DOCKER_OPTS="-b=bridge0"' >> /etc/default/docker
$ sudo service docker start
```
docker服务启动成功并绑定容器到新的网桥新建一个容器你会看到它的ip是我们的设置的新ip段docker会自动检测到它。用brctl
show可以看到容器启动或则停止后网桥的配置变化在容器中使用```ip addr```和```ip route```来查看ip地址配置和路由信息
启动 Docker 服务。
新建一个容器,可以看到它已经桥接到了 `bridge0`
可以继续用 `brctl show` 命令查看桥接的信息。另外,在容器中可以使用 `ip addr``ip route` 命令来查看 IP 地址配置和路由信息。

View File

@@ -1,39 +0,0 @@
##容器之间的通信
判断2个容器之间是否能够通信在操作系统层面取决于3个因素
* 网络拓扑是否连接到容器的网络接口默认docker会将所有的容器连接到docker0这网桥来提供数据包通信。其他拓扑结构将在稍后的文档中详细介绍。
* 主机是否开启ip转发ip_forward参数为1的时候可以提供数据包转发。通常你只需要为docker 设定 --ip-forward=true,
docker 就会在服务启动的时候设定ip_forward参数为1。下面是手工检查并手工设定该参数的方法。
```
# Usually not necessary: turning on forwarding,
# on the host where your Docker server is running
$ cat /proc/sys/net/ipv4/ip_forward
0
$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
$ cat /proc/sys/net/ipv4/ip_forward
1
```
*你的iptables是否允许这条特殊的连接被建立当docker的设定--iptables=false时docker不会改变系统的iptables
设定,否则它会在--icc=true的时候添加一条默认的ACCEPT策略到 FORWARD链当—icc=false时策略为DROP。几乎所有的人都会开启ip_forward来启用容器间的通信。但是否要改变icc-true配置是一个战略问题。这样iptable就可以防止其他被感染容器对宿主主机的恶意端口扫描和访问。
当你选择更安全的设定--icc=false后如何保持你希望的容器之间通信呢
答案就是--link=CONTAINER_NAME:ALIAS选项在之前的dns服务设定中提及过。如果docker 使用icc=false and --iptables=true 2个参数当docker run使用--link=选型时docker会为2个容器在iptable中参数一对ACCEPT规则开放的端口取决与dockerfile中的EXPOSE行详见第五章。
注意:--link= 中的CONTAINER_NAME 必须是自动生成的docker名字比如stupefied_pare或者你用--name参数指定的名字主机名在--link中不会被识别。
你可以使用iptables命令来检查FORWARD链是ACCEPT 还是DROP
当--icc=false时默认规则应该是这样
```
$ sudo iptables -L -n
...
Chain FORWARD (policy ACCEPT)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0
...
```
当添加了--link后ACCEPT规则被改写了添加了新的端口和IP规则
```
$ sudo iptables -L -n
...
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 172.17.0.2 172.17.0.3 tcp spt:80
ACCEPT tcp -- 172.17.0.3 172.17.0.2 tcp dpt:80
DROP all -- 0.0.0.0/0 0.0.0.0/0
```

View File

@@ -0,0 +1,5 @@
## 编辑网络配置文件
Docker 1.2.0 开始支持在运行中的容器里编辑 `/etc/hosts`, `/etc/hostname``/etc/resolve.conf` 文件。
但是这些修改是临时的,只在运行的容器中保留,容器终止或重启后并不会被保存下来。也不会被 `docker commit` 提交。

View File

@@ -1,5 +1,8 @@
##配置DNS
docker没有定制为每个容器定制image是怎么提供容器的主机名和dns配置呢秘诀就是它用主机上的3个配置文件来覆盖容器的这3个文件在容器中使用mount命令可以看到
## 配置 DNS
Docker 没有为每个容器专门定制镜像,那么怎么自定义配置容器的主机名和 DNS 配置呢?
秘诀就是它利用虚拟文件来挂载到来容器的 3 个相关配置文件。
在容器中使用 mount 命令可以看到挂载信息:
```
$ mount
...
@@ -8,18 +11,19 @@ $ mount
tmpfs on /etc/resolv.conf type tmpfs ...
...
```
这种机制可以让宿主主机从dhcp更新dns信息后马上更新所有docker容器的dns配置。如果要保持docker中这些文件固定不变你可以不覆盖容器中的这些配置文件然后使用下面的选项来配置它们
配置容器dns服务的方法
这种机制可以让宿主主机 DNS 信息发生更新后,所有 Docker 容器的 dns 配置通过 `/etc/resolv.conf` 文件立刻得到更新
-h HOSTNAME or --hostname=HOSTNAME
设定容器的主机名,它会被写到/etc/hostname/etc/hosts中的ip地址自动写成分配的ip地址在/bin/bash中显示该主机名。但它不会在docker ps中显示也不会在其他的容器的/etc/hosts中显示。
如果用户想要手动指定容器的配置,可以利用下面的选项。
--link=CONTAINER_NAME:ALIAS
这选项会在创建容器的时候添加一个其他容器CONTAINE_NAME的主机名到/etc/hosts文件中让新容器的进程可以使用主机名ALIAS就可以连接它。--link=会在容器之间的通信中更详细的介绍
`-h HOSTNAME or --hostname=HOSTNAME`
设定容器的主机名,它会被写到容器内的 `/etc/hostname``/etc/hosts`。但它在容器外部看不到,既不会在 `docker ps` 中显示,也不会在其他的容器的 `/etc/hosts` 看到。
--dns=IP_ADDRESS
添加dns服务器到容器的/etc/resolv,conf中让容器用这ip地址来解析所有不在/etc/hosts中的主机名
`--link=CONTAINER_NAME:ALIAS`
选项会在创建容器的时候,添加一个其他容器的主机名到 `/etc/hosts` 文件中,让新容器的进程可以使用主机名 ALIAS 就可以连接它
--dns-search=DOMAIN
设定容器的搜索域,当设定搜索域为.example.com时会在搜索一个host主机名时dns不仅搜索host还会搜索host.example.com
注意如果没有上述最后2个选项docker会用主机上的/etc/resolv.conf来配置容器它是默认配置。
`--dns=IP_ADDRESS`
添加 DNS 服务器到容器的 `/etc/resolv.conf` 中,让容器用这个服务器来解析所有不在 `/etc/hosts` 中的主机名。
`--dns-search=DOMAIN`
设定容器的搜索域,当设定搜索域为 `.example.com` 时,在搜索一个名为 host 的主机时DNS 不仅搜索host还会搜索 `host.example.com`
注意:如果没有上述最后 2 个选项Docker 会默认用主机上的 `/etc/resolv.conf` 来配置容器。

View File

@@ -1,19 +1,22 @@
##定制docker0
docker服务默认会创建一个docker0接口它在linux内核层桥接所有物理或虚拟网卡,这就将所有容器和主机接口都放到同一个物理网络。
Docker指定了docker0的ip地址和子网掩码让主机和容器之间可以通过网桥相互通信它还给出了MTU-接口允许接收的最大传输单元通常是1500bytes或宿主主机网络路由上支持的默认值这2个都需要在服务启动的时候配置。
* --bip=CIDR — 192.168.1.5/24.ip地址加掩码 使用这种格式
* --mtu=BYTES — 覆盖默认的docker mtu配置
## 配置 docker0 网桥
Docker 服务默认会创建一个 `docker0` 网桥(其上有一个 `docker0` 内部接口,它在内核层连通了其他的物理或虚拟网卡,这就将所有容器和本地主机都放到同一个物理网络。
你可以在配置文件中配置DOCKER_OPTS然后重启来改变这些参数
Docker 默认指定了 `docker0` 接口 的 IP 地址和子网掩码,让主机和容器之间可以通过网桥相互通信,它还给出了 MTU接口允许接收的最大传输单元通常是 1500 Bytes或宿主主机网络路由上支持的默认值。这些值都可以在服务启动的时候进行配置
* `--bip=CIDR` -- IP 地址加掩码格式,例如 192.168.1.5/24
* `--mtu=BYTES` -- 覆盖默认的 Docker mtu 配置
也可以在配置文件中配置 DOCKER_OPTS然后重启服务。
由于目前 Docker 网桥是 Linux 网桥,用户可以使用 `brctl show` 来查看网桥和端口连接信息。
```
# 当容器启动后你可以使用brctl来确认他们是否已经连接到docker0网桥
$ sudo brctl show
bridge name bridge id STP enabled interfaces
docker0 8000.3a1d7362b4ee no veth65f9
vethdda6
```
如果brctl命令没安装的话在ubuntu中可以使用apt-get install bridge-utils这个命令来安装
docker0 网桥设置会在每次创建新容器的时候被使用。docker从可用的地址段中选择一个空闲的ip地址给容器的eth0端口子网掩码使用网桥docker0的配置docker主机本身的ip作为容器的网关使用。
```
*注:`brctl` 命令在 Debian、Ubuntu 中可以使用 `sudo apt-get install bridge-utils` 来安装
每次创建一个新容器的时候Docker 从可用的地址段中选择一个空闲的 IP 地址分配给容器的 eth0 端口。使用本地主机上 `docker0` 接口的 IP 作为所有容器的默认网关。
```
$ sudo docker run -i -t --rm base /bin/bash
$ ip addr show eth0
@@ -28,4 +31,3 @@ default via 172.17.42.1 dev eth0
172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.3
$ exit
```
转发数据包需要在主机上设定ip_forward参数为1,上文介绍过。

View File

@@ -1,8 +1,8 @@
##工具和示例
## 工具和示例
在介绍自定义网络拓扑之前,你可能会对一些外部工具和例子感兴趣:
https://github.com/jpetazzo/pipework
Jérôme Petazzoni 创建了一个叫pipework的shell脚本来帮助我们在复杂的场景中完成网络连接
https://github.com/brandon-rhodes/fopnp/tree/m/playground
Brandon Rhodes创建了一个完整的docker容器网络拓扑包含 nat 防火墙服务包括HTTP, SMTP, POP, IMAP, Telnet, SSH, and FTP:
工具使用的网络命令跟我们之前看到非常相似。
### pipework
Jérôme Petazzoni 编写了一个叫 [pipework](https://github.com/jpetazzo/pipework) 的 shell 脚本,可以帮助用户在比较复杂的场景中完成容器的连接。
### playground
Brandon Rhodes 创建了一个提供完整的 Docker 容器网络拓扑管理的 [Python库](https://github.com/brandon-rhodes/fopnp/tree/m/playground)包括路由、NAT 防火墙;以及一些提供 HTTP, SMTP, POP, IMAP, Telnet, SSH, FTP 的服务器。

View File

@@ -1,23 +0,0 @@
##快速配置指南
下面是一个跟docker网络相关的命令列表希望可以让你快速找到需要的信息。有些命令选项只有在docker服务启动的时候才可以执行而且不能马上生效。
* -b BRIDGE or --bridge=BRIDGE — 桥接配置
* --bip=CIDR — 定制docker0的掩码
* -H SOCKET... or --host=SOCKET... — 它告诉docker从哪个通道来接收run container stop
container这样的命令也是docker api的地址
* --icc=true|false — 请看下文容器之间的通信
* --ip-forward=true|false — 请看下文容器之间的通信
* --iptables=true|false — 请看下文容器之间的通信
* --mtu=BYTES —请看下文定制docker0
下面2个可以在docker服务启动和docker run执行的时候指定服务启动的时候指定则会为docker run设定默认值docker run 后面指定可以覆盖默认值。
* --dns=IP_ADDRESS... — 请看下文dns配置
* --dns-search=DOMAIN... — 请看下文dns配置
最后这些选项只有在docker run后执行因为它是针对容器的特性内容。
*-h HOSTNAME or --hostname=HOSTNAME — 主机名配置
*--link=CONTAINER_NAME:ALIAS — link系统
*--net=bridge|none|container:NAME_or_ID|host —桥接配置
*-p SPEC or --publish=SPEC — 映射容器端口到宿主主机
* -P or --publish-all=true|false — 映射容器端口到宿主主机

View File

@@ -1,60 +1 @@
##Docker 如何连接到容器?
让我们回顾一些基础知识:
机器需要一个网络接口来发送和接受数据包路由表来定义如何到达哪些地址段。这里的网络接口可以不是物理接口。事实上每个linxu机器上的lo环回接口docker 容器中也有就是一个完全的linux内核虚拟接口它直接复制发送缓存中的数据包到接收缓存中。docker让宿主主机和容器使用特殊的虚拟接口来通信--通信的2端叫“peers“他们在主机内核中连接在一起所以能够相互通信。创建他们很简单前面介绍过了。
docker创建容器的步骤如下
* 创建一对虚拟接口
* 其中宿主主机一端使用一个名字比如veth65f9他是唯一的,另外一端桥接到默认的docker0,或其它你指定的桥接网卡。
* 主机上的veth65f9这种接口映射到新的新容器中的名称通常是eth0,在容器这个隔离的network namespace
中,它是唯一的,不会有其他接口名字和它冲突。
* 从主机桥接网卡的地址段中获取一个空闲地址给eth0使用并设定默认路由到桥接网卡。
* 完成这些之后容器就可以使用这eth0虚拟网卡来连接其他容器和其他网络。
你也可以为特殊的容器设定特定的参数在docker run的时候使用--net它有4个可选参数
* --net=bridge — .默认连接到docker0网桥。
* --net=host — 告诉docker不要将容器放到隔离的网络堆栈中。从本质上讲这个选项告诉docker
不要容器化容器的网络尽管容器还是有自己的文件系统、进程列表和资源限制。但使用ip addr命令这样命令就可以知道实际上此时的的容器处于和docker 宿主主机的一样的网络级别,它拥有完全的宿主主机接口访问权限。虽然它不允许容器重新配置主机的网络堆栈,除非--privileged=true — 但是容器进程可以跟其他root进程一样可以打开低数字的端口可以访问本地网络服务比如D-bus还可以让容器做一些意想不到的事情比如重启主机使用这个选项的时候要非常小心
* --net=container:NAME_or_ID —
告诉docker将新容器的进程放到一个已经存在的容器的网络堆栈中新容器进程有它自己的文件系统、进程列表和资源限制但它会和那个已经存在的容器共享ip地址和端口他们之间来可以通过环回接口通信。
* --net=none — 告诉docker将新容器放到自己的网络堆栈中但是不要配置它的网络,
类似于vmware的host-only。这可以让你创建任何自定义的配置本文最后一段将介绍 他们。
下面通过配置一个以--net=none启动的容器使他达到跟平常一样具有访问网络的权限。来介绍docker是如何连接到容器中的。
启动一个/bin/bash 指定--net=none
```
$ sudo docker run -i -t --rm --net=none base /bin/bash
root@63f36fc01b5f:/#
```
再开启一个新的终端查找这个容器的进程id然后创建它的命名空间后面的ip netns会用到
```$ sudo docker inspect -f '{{.State.Pid}}' 63f36fc01b5f
2778
$ pid=2778
$ sudo mkdir -p /var/run/netns
$ sudo ln -s /proc/$pid/ns/net /var/run/netns/$pid
```
检查桥接网卡的ip和子网掩码
```
$ ip addr show docker0
21: docker0: ...
inet 172.17.42.1/16 scope global docker0
...
```
创建一对”peer“接口A和B绑定A到网桥并启用它
```
$ sudo ip link add A type veth peer name B
$ sudo brctl addif docker0 A
$ sudo ip link set A up
```
将B放到容器的网络命名空间命名为eth0,配置一个空闲的ip
```
$ sudo ip link set B netns $pid
$ sudo ip netns exec $pid ip link set dev B name eth0
$ sudo ip netns exec $pid ip link set eth0 up
$ sudo ip netns exec $pid ip addr add 172.17.42.99/16 dev eth0
$ sudo ip netns exec $pid ip route add default via 172.17.42.1
```
自此,你又可以像平常一样使用网络了
当你退出shell后docker清空容器容器的eth0随网络命名空间一起被摧毁A 接口也被自动从docker0取消注册。不用其他命令所有东西都被清理掉了
注意ip netns exec命令它可以让我们像root一样配置网络命名空间。但在容器内部无法使用因为统一的安全策略docker限制容器进程配置自己的网络。使用ip netns exec 可以让我们不用设置--privileged=true就可以完成一些可能带来危险的操作。

View File

@@ -1,37 +1,43 @@
##映射一个容器端口到宿主主机
## 映射容器端口到宿主主机的实现
默认情况下,容器可以建立到外部网络的连接,但是外部网络无法连接到容器。所有到外部的连接源地址都会被伪装成宿主主机的ip地址iptables的 masquerading来做到这一点。
默认情况下,容器可以主动访问到外部网络的连接,但是外部网络无法访问到容器。
### 容器访问外部实现
容器所有到外部网络的连接源地址都会被NAT成本地系统的IP地址。这是使用 `iptables` 的源地址伪装操作实现的。
查看主机的 NAT 规则。
```
# 查看主机的masquerading规则
$ sudo iptables -t nat -L -n
$ sudo iptables -t nat -nL
...
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 172.17.0.0/16 !172.17.0.0/16
...
```
其中,上述规则将所有源地址在 `172.17.0.0/16` 网段目标地址为其他网段外部网络的流量动态伪装为从系统网卡发出。MASQUERADE 跟传统 SNAT 的好处是它能动态从网卡获取地址。
当你希望容器接收外部连接时你需要在docker run执行的时候就指定对应选项第五章详细介绍了2种方法
* 指定-P --publish-all=true|false 选项会映射dockerfile
中expose的所有端口主机端口在49000-49900中随机挑选。当你的另外一个容器需要学习这个端口时候很不方便。
* 指定-p SPEC或则 --publish=SPEC,可以指定任意端口从主机映射容器内部
### 外部访问容器实现
不管用那种办法你可以通过查看iptable的 nat表来观察docker 在网络层做了什么操作
容器允许外部访问,可以在 `docker run` 时候通过 `-p``-P` 参数来启用
不管用那种办法,其实也是在本地的 `iptable` 的 nat 表中添加相应的规则。
使用 `-P` 时:
```
#使用-P时
$ iptables -t nat -L -n
$ iptables -t nat -nL
...
Chain DOCKER (2 references)
target prot opt source destination
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:49153 to:172.17.0.2:80
#使用-p 80:80时
$ iptables -t nat -L -n
```
使用 `-p 80:80` 时:
```
$ iptables -t nat -nL
Chain DOCKER (2 references)
target prot opt source destination
DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:172.17.0.2:80
```
注意:
* 这里看到docker映射了0.0.0.0.它接受主机上的所有接口地址。可以通过-p IP:host_port:container_port 或则 -p
IP::port 来指定主机上的ip、接口制定更严格的规则。
* 如果希望永久改变绑定的主机ip地址可以 在dcoker 配置中指定--ip=IP_ADDRESS. 记得重启服务
* 这里的规则映射了 0.0.0.0,意味着将接受主机来自所有接口的流量。用户可以通过 `-p IP:host_port:container_port` 或 `-p
IP::port` 来指定允许访问容器的主机上的 IP、接口等制定更严格的规则。
* 如果希望永久绑定到某个固定的 IP 地址,可以在 Docker 配置文件 `/etc/default/docker` 中指定 `DOCKER_OPTS="--ip=IP_ADDRESS"`,之后重启 Docker 服务即可生效。

View File

@@ -1,15 +1,19 @@
##创建一个点到点连接
默认docker会将所有容器连接到由docker0提供的虚拟子网你也可以使用自己创建的网桥。但如果你想要2个特殊的容器之间可以直连通信而不用去配置复杂的主机网卡桥接
解决办法很简单创建一对接口把2个容器放到这对接口中配置成点到点链路类型。这2个容器就可以直接通信了。配置如下
## 示例:创建一个点到点连接
默认情况下Docker 会将所有容器连接到由 `docker0` 提供的虚拟子网
用户有时候需要两个容器之间可以直连通信,而不用通过主机网桥进行桥接。
解决办法很简单:创建一对 `peer` 接口,分别放到两个容器中,配置成点到点链路类型即可。
首先启动 2 个容器:
```
# 在2个终端中启动2个容器
$ sudo docker run -i -t --rm --net=none base /bin/bash
root@1f1f4c1f931a:/#
$ sudo docker run -i -t --rm --net=none base /bin/bash
root@12e343489d2f:/#
```
找到他们的process IDs ,然后创建他们的 namespace entries
找到进程号,然后创建网络命名空间的跟踪文件。
```
$ sudo docker inspect -f '{{.State.Pid}}' 1f1f4c1f931a
2989
@@ -20,7 +24,7 @@ $ sudo ln -s /proc/2989/ns/net /var/run/netns/2989
$ sudo ln -s /proc/3004/ns/net /var/run/netns/3004
```
创建"peer"接口,然后配置路由
创建一对 `peer` 接口,然后配置路由
```
$ sudo ip link add A type veth peer name B
@@ -34,7 +38,8 @@ $ sudo ip netns exec 3004 ip addr add 10.1.1.2/32 dev B
$ sudo ip netns exec 3004 ip link set B up
$ sudo ip netns exec 3004 ip route add 10.1.1.1/32 dev B
```
现在这2个容器就可以相互ping通并成功建立连接。点到点链路不需要子网和子网掩码使用ip route 来连接单个ip地址到指定的网络接口
如果没有特殊需要你不需要指定--net=none来创建点到点链路。
现在这 2 个容器就可以相互 ping 通,并成功建立连接。点到点链路不需要子网和子网掩码。
还有一个办法就是创建一个只跟主机通信的容器,除非有特殊需求,你可以仅用--icc=false来限制主机间的通信。
此外,也可以不指定 `--net=none` 来创建点到点链路。这样容器还可以通过原先的网络来通信。
利用类似的办法,可以创建一个只跟主机通信的容器。但是一般情况下,更推荐使用 `--icc=false` 来关闭容器之间的通信。

View File

@@ -0,0 +1,23 @@
## 快速配置指南
下面是一个跟 Docker 网络相关的命令列表。
其中有些命令选项只有在 Docker 服务启动的时候才能配置,而且不能马上生效。
* `-b BRIDGE or --bridge=BRIDGE` --指定容器挂载的网桥
* `--bip=CIDR` --定制 docker0 的掩码
* `-H SOCKET... or --host=SOCKET...` --Docker 服务端接收命令的通道
* `--icc=true|false` --是否支持容器之间进行通信
* `--ip-forward=true|false` --请看下文容器之间的通信
* `--iptables=true|false` --是否允许 Docker 添加 iptables 规则
* `--mtu=BYTES` --容器网络中的 MTU
下面2个命令选项既可以在启动服务时指定也可以 Docker 容器启动(`docker run`)时候指定。在 Docker 服务启动的时候指定则会成为默认值,后面执行 `docker run` 时可以覆盖设置的默认值。
* `--dns=IP_ADDRESS...` --使用指定的DNS服务器
* `--dns-search=DOMAIN...` --指定DNS搜索域
最后这些选项只有在 `docker run` 执行时使用,因为它是针对容器的特性内容。
* `-h HOSTNAME or --hostname=HOSTNAME` --配置容器主机名
* `--link=CONTAINER_NAME:ALIAS` --添加到另一个容器的连接
* `--net=bridge|none|container:NAME_or_ID|host` --配置容器的桥接模式
* `-p SPEC or --publish=SPEC` --映射容器端口到宿主主机
* `-P or --publish-all=true|false` --映射容器所有端口到宿主主机

1
appendix/README.md Normal file
View File

@@ -0,0 +1 @@
# 附录

View File

@@ -0,0 +1,56 @@
//dot -Tpng xx.dot -o xx.png
digraph G {
rankdir=TB;
fontname = "Microsoft YaHei";
fontsize = 14;
penwidth = 3;
compound=true;
rankdir=LR;
node [shape = record];
edge [fontname = "Arial", fontsize = 12, color="darkgreen" ];
image[label="Image",color=blue];
registry[label="Registry",color=blue];
tar[label="Tar files",color=blue];
subgraph cluster_container {
label = "Container";
style = "bold";
color = blue;
edge [fontname = "Arial", fontsize = 11, color="skyblue" ];
//node [style=filled];
run[label="Running",shape=circle, style=filled, fillcolor=green];
stop[label="Stopped",shape=circle, style=filled, fillcolor=red];
pause[label="Paused",shape=circle, style=filled, fillcolor=blue];
run->pause[label="pause"];
pause->run[label="unpause"];
run->run[label="restart"];
run->stop[label="kill"];
stop->run[label="start"];
}
run->image[label="commit",ltail=cluster_container];
image->run[label="start"];
image->tar[label="export|save"];
tar->image[label="import"];
image->registry[label="push"];
registry->image[label="pull"];
//heat[label="heat commands",color=blue];
//heatshell[label="heatclient.shell.HeatShell",color=blue];
//shell[label="{heatclient.v1.shell|+do_stack_create\l+do_stack_show\l+do_stack_update\l...\l+do_event_list\l...\l+do_resource_list\l...\l+do_resource_type_show\l...\l+do_template_show\l...\l}",color=blue];
//heatclient[label="heatclient.client.Client",color=blue];
//client[label="heatclient.v1.client.Client",color=blue];
//httpclient[label="heatclient.common.http.HTTPClient",color=blue];
//openstackservices[label="{OpenStack Services|+Nova\l+Neutron\l+Keystone\l...}",color=blue];
//{rank=same; image cluster_container}
//{rank=same; rpcproxy apimixin}
}

View File

@@ -0,0 +1,93 @@
//dot -Tpng cmd_logic.dot -o cmd_logic.png
digraph G {
rankdir=TB;
rankdir=LR;
nodesep=1;
//ranksep=1
fontname = "Microsoft YaHei";
fontsize = 28;
penwidth = 4;
compound=true;
node [shape = record];
edge [fontname = "Arial", fontsize = 20, color="darkgreen" ];
user[label="User",color=blue,shape=ellipse, style=filled, fillcolor=green];
dockerfile[label="Dockerfile",color=blue];
daemon[label="Daemon",color=blue];
image[label="Image",color=blue];
registry[label="Registry",color=blue];
tar[label="Tar files",color=blue];
network[label="Network",color=blue]
service[label="Service",color=blue]
swarm[label="Swarm",color=blue]
volume[label="Volume",color=blue]
subgraph cluster_container {
label = "Container";
labelloc = "c";
nodesep=.5;
style = "bold";
color = blue;
edge [fontname = "Arial", fontsize = 20, color="skyblue" ];
//node [style=filled];
create[label="Created",shape=circle, style=filled, fillcolor=lightblue];
run[label="Running",shape=circle, style=filled, fillcolor=green];
pause[label="Paused",shape=circle, style=filled, fillcolor=blue];
stop[label="Stopped",shape=circle, style=filled, fillcolor=red];
exit[label="Exited",shape=circle, style=filled, fillcolor=gray];
create->run[label=<<i>start</i>>];
run->pause[label="pause"];
pause->run[label="unpause"];
run->run[label="restart"];
run->stop[label="stop"];
run->exit[label="kill"];
stop->run[label="start"];
}
//dockerfile
dockerfile->image[label="build"];
//container
run->image[headlabel="commit", labeldistance=7.5, ltail=cluster_container];
run->tar[label="export",ltail=cluster_container];
run->network[label="connect | disconnect",ltail=cluster_container];
//image
image->create[label="create"];
image->run[label="run"];
image->tar[label="save"];
image->registry[label="push"];
//tar
tar->image[label="import | load"];
image->registry[label="push"];
//registry
registry->image[label="pull"];
//network
network->network[label="create | rm | ls | inspect"]
//user
user->run[label="attach | cp | diff | exec | inspect | logs | ps | rename | rm | stats | top | update | wait",lhead=cluster_container]
user->image[label="history | images | rmi | tag"]
user->daemon[label="event | info | version"]
user->registry[label="login | logout | search"]
//heat[label="heat commands",color=blue];
//heatshell[label="heatclient.shell.HeatShell",color=blue];
//shell[label="{heatclient.v1.shell|+do_stack_create\l+do_stack_show\l+do_stack_update\l...\l+do_event_list\l...\l+do_resource_list\l...\l+do_resource_type_show\l...\l+do_template_show\l...\l}",color=blue];
//heatclient[label="heatclient.client.Client",color=blue];
//client[label="heatclient.v1.client.Client",color=blue];
//httpclient[label="heatclient.common.http.HTTPClient",color=blue];
//openstackservices[label="{OpenStack Services|+Nova\l+Neutron\l+Keystone\l...}",color=blue];
//{rank=same; image registry dockerfile tar}
//{rank=same; container}
//{rank=same; user}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 KiB

View File

@@ -0,0 +1,51 @@
//dot -Tpng container_status.dot -o container_status.png
digraph G {
rankdir=TB;
rankdir=LR;
nodesep=1;
//ranksep=1
fontname = "Microsoft YaHei";
fontsize = 28;
penwidth = 4;
compound=true;
style = "bold";
color = blue;
node [shape = record];
edge [fontname = "Arial", fontsize = 20, color="darkgreen" ];
image[label="Image",color=blue];
image->create[label="create"];
image->run[label="run"];
edge [fontname = "Arial", fontsize = 20, color="skyblue" ];
//node [style=filled];
create[label="Created",shape=circle, style=filled, fillcolor=lightblue];
run[label="Running",shape=circle, style=filled, fillcolor=green];
pause[label="Paused",shape=circle, style=filled, fillcolor=blue];
stop[label="Stopped",shape=circle, style=filled, fillcolor=red];
exit[label="Exited",shape=circle, style=filled, fillcolor=gray];
create->run[label=<<i>start</i>>];
run->pause[label="pause"];
pause->run[label="unpause"];
run->run[label="restart"];
run->stop[label="stop"];
run->exit[label="kill"];
stop->run[label="start"];
//heat[label="heat commands",color=blue];
//heatshell[label="heatclient.shell.HeatShell",color=blue];
//shell[label="{heatclient.v1.shell|+do_stack_create\l+do_stack_show\l+do_stack_update\l...\l+do_event_list\l...\l+do_resource_list\l...\l+do_resource_type_show\l...\l+do_template_show\l...\l}",color=blue];
//heatclient[label="heatclient.client.Client",color=blue];
//client[label="heatclient.v1.client.Client",color=blue];
//httpclient[label="heatclient.common.http.HTTPClient",color=blue];
//openstackservices[label="{OpenStack Services|+Nova\l+Neutron\l+Keystone\l...}",color=blue];
//{rank=same; image registry dockerfile tar}
//{rank=same; container}
//{rank=same; user}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

126
appendix/command/README.md Normal file
View File

@@ -0,0 +1,126 @@
# Docker 命令查询
## 基本语法
Docker 命令有两大类,客户端命令和服务端命令。前者是主要的操作接口,后者用来启动 Docker daemon。
* 客户端命令:基本命令格式为 `docker [OPTIONS] COMMAND [arg...]`
* 服务端命令:基本命令格式为 `docker daemon [OPTIONS]`
可以通过 `man docker``docker help` 来查看这些命令。
## 客户端命令选项
* --config="":指定客户端配置文件,默认为 `/.docker`
* -D=true|false是否使用 debug 模式。默认不开启;
* -H, --host=[]:指定命令对应 Docker daemon 的监听接口,可以为 unix 套接字unix:///path/to/socket文件句柄fd://socketfd或 tcp 套接字tcp://[host[:port]]),默认为 unix:///var/run/docker.sock
* -l, --log-level="debug|info|warn|error|fatal":指定日志输出级别;
* --tls=true|false是否对 Docker daemon 启用 TLS 安全机制,默认为否;
* --tlscacert= /.docker/ca.pemTLS CA 签名的可信证书文件路径;
* --tlscert= /.docker/cert.pemTLS 可信证书文件路径;
* --tlscert= /.docker/key.pemTLS 密钥文件路径;
* --tlsverify=true|false启用 TLS 校验,默认为否。
## daemon 命令选项
* --api-cors-header=""CORS 头部域,默认不允许 CORS要允许任意的跨域访问可以指定为 “*”;
* --authorization-plugin="":载入认证的插件;
* -b="":将容器挂载到一个已存在的网桥上。指定为 'none' 时则禁用容器的网络,与 --bip 选项互斥;
* --bip="":让动态创建的 docker0 网桥采用给定的 CIDR 地址; 与 -b 选项互斥;
* --cgroup-parent="":指定 cgroup 的父组,默认 fs cgroup 驱动为 `/docker`systemd cgroup 驱动为 `system.slice`
* --cluster-store="":构成集群(如 Swarm集群键值数据库服务地址
* --cluster-advertise="":构成集群时,自身的被访问地址,可以为 `host:port``interface:port`
* --cluster-store-opt="":构成集群时,键值数据库的配置选项;
* --config-file="/etc/docker/daemon.json"daemon 配置文件路径;
* --containerd=""containerd 文件的路径;
* -D, --debug=true|false是否使用 Debug 模式。缺省为 false
* --default-gateway="":容器的 IPv4 网关地址,必须在网桥的子网段内;
* --default-gateway-v6="":容器的 IPv6 网关地址;
* --default-ulimit=[]:默认的 ulimit 值;
* --disable-legacy-registry=true|false是否允许访问旧版本的镜像仓库服务器
* --dns="":指定容器使用的 DNS 服务器地址;
* --dns-opt=""DNS 选项;
* --dns-search=[]DNS 搜索域;
* --exec-opt=[]:运行时的执行选项;
* --exec-root="":容器执行状态文件的根路径,默认为 `/var/run/docker`
* --fixed-cidr="":限定分配 IPv4 地址范围;
* --fixed-cidr-v6="":限定分配 IPv6 地址范围;
* -G, --group="":分配给 unix 套接字的组,默认为 `docker`
* -g, --graph=""Docker 运行时的根路径,默认为 `/var/lib/docker`
* -H, --host=[]:指定命令对应 Docker daemon 的监听接口,可以为 unix 套接字unix:///path/to/socket文件句柄fd://socketfd或 tcp 套接字tcp://[host[:port]]),默认为 unix:///var/run/docker.sock
* --icc=true|false是否启用容器间以及跟 daemon 所在主机的通信。默认为 true。
* --insecure-registry=[]:允许访问给定的非安全仓库服务;
* --ip="":绑定容器端口时候的默认 IP 地址。缺省为 0.0.0.0
* --ip-forward=true|false是否检查启动在 Docker 主机上的启用 IP 转发服务,默认开启。注意关闭该选项将不对系统转发能力进行任何检查修改;
* --ip-masq=true|false是否进行地址伪装用于容器访问外部网络默认开启
* --iptables=true|false是否允许 Docker 添加 iptables 规则。缺省为 true
* --ipv6=true|false是否启用 IPv6 支持,默认关闭;
* -l, --log-level="debug|info|warn|error|fatal":指定日志输出级别;
* --label="[]":添加指定的键值对标注;
* --log-driver="json-file|syslog|journald|gelf|fluentd|awslogs|splunk|etwlogs|gcplogs|none":指定日志后端驱动,默认为 json-file
* --log-opt=[]:日志后端的选项;
* --mtu=VALUE指定容器网络的 mtu
* -p="":指定 daemon 的 PID 文件路径。缺省为 `/var/run/docker.pid`
* --raw-logs输出原始未加色彩的日志信息
* --registry-mirror=<scheme>://<host>:指定 `docker pull` 时使用的注册服务器镜像地址;
* -s, --storage-driver="":指定使用给定的存储后端;
* --selinux-enabled=true|false是否启用 SELinux 支持。缺省值为 false。SELinux 目前尚不支持 overlay 存储驱动;
* --storage-opt=[]:驱动后端选项;
* --tls=true|false是否对 Docker daemon 启用 TLS 安全机制,默认为否;
* --tlscacert= /.docker/ca.pemTLS CA 签名的可信证书文件路径;
* --tlscert= /.docker/cert.pemTLS 可信证书文件路径;
* --tlscert= /.docker/key.pemTLS 密钥文件路径;
* --tlsverify=true|false启用 TLS 校验,默认为否;
* --userland-proxy=true|false是否使用用户态代理来实现容器间和出容器的回环通信默认为 true
* --userns-remap=default|uid:gid|user:group|user|uid指定容器的用户命名空间默认是创建新的 UID 和 GID 映射到容器内进程。
## 客户端命令
可以通过 `man docker-COMMAND``docker help COMMAND` 来查看这些命令的具体用法。
* attach依附到一个正在运行的容器中
* build从一个 Dockerfile 创建一个镜像;
* commit从一个容器的修改中创建一个新的镜像
* cp在容器和本地宿主系统之间复制文件中
* create创建一个新容器但并不运行它
* diff检查一个容器内文件系统的修改包括修改和增加
* events从服务端获取实时的事件
* exec在运行的容器内执行命令
* export导出容器内容为一个 tar 包;
* history显示一个镜像的历史信息
* images列出存在的镜像
* import导入一个文件典型为 tar 包)路径或目录来创建一个本地镜像;
* info显示一些相关的系统信息
* inspect显示一个容器的具体配置信息
* kill关闭一个运行中的容器 (包括进程和所有相关资源)
* load从一个 tar 包中加载一个镜像;
* login注册或登录到一个 Docker 的仓库服务器;
* logout从 Docker 的仓库服务器登出;
* logs获取容器的 log 信息;
* network管理 Docker 的网络,包括查看、创建、删除、挂载、卸载等;
* node管理 swarm 集群中的节点,包括查看、更新、删除、提升/取消管理节点等;
* pause暂停一个容器中的所有进程
* port查找一个 nat 到一个私有网口的公共口;
* ps列出主机上的容器
* pull从一个Docker的仓库服务器下拉一个镜像或仓库
* push将一个镜像或者仓库推送到一个 Docker 的注册服务器;
* rename重命名一个容器
* restart重启一个运行中的容器
* rm删除给定的若干个容器
* rmi删除给定的若干个镜像
* run创建一个新容器并在其中运行给定命令
* save保存一个镜像为 tar 包文件;
* search在 Docker index 中搜索一个镜像;
* service管理 Docker 所启动的应用服务,包括创建、更新、删除等;
* start启动一个容器
* stats输出一个或多个容器的资源使用统计信息
* stop终止一个运行中的容器
* swarm管理 Docker swarm 集群,包括创建、加入、退出、更新等;
* tag为一个镜像打标签
* top查看一个容器中的正在运行的进程信息
* unpause将一个容器内所有的进程从暂停状态中恢复
* update更新指定的若干容器的配置信息
* version输出 Docker 的版本信息;
* volume管理 Docker volume包括查看、创建、删除等
* wait阻塞直到一个容器终止然后输出它的退出符。
## 一张图总结 Docker 的命令
![Docker 命令总结](../_images/cmd_logic.png)

192
appendix/faq/README.md Normal file
View File

@@ -0,0 +1,192 @@
# 常见问题总结
## 镜像相关
### 如何批量清理临时镜像文件
答:可以使用 `docker rmi $(docker images -q -f dangling=true)` 命令。
### 如何查看镜像支持的环境变量?
答:可以使用 `docker run IMAGE env` 命令。
### 本地的镜像文件都存放在哪里?
答:与 Docker 相关的本地资源都存放在 `/var/lib/docker/` 目录下,以 aufs 文件系统为例,其中 container 目录存放容器信息graph 目录存放镜像信息aufs 目录下存放具体的镜像层文件。
### 构建 Docker 镜像应该遵循哪些原则?
答:整体原则上,尽量保持镜像功能的明确和内容的精简,要点包括
* 尽量选取满足需求但较小的基础系统镜像,例如大部分时候可以选择 debian:wheezy 或 debian:jessie 镜像,仅有不足百兆大小;
* 清理编译生成文件、安装包的缓存等临时文件;
* 安装各个软件时候要指定准确的版本号,并避免引入不需要的依赖;
* 从安全角度考虑,应用要尽量使用系统的库和依赖;
* 如果安装应用时候需要配置一些特殊的环境变量,在安装后要还原不需要保持的变量值;
* 使用 Dockerfile 创建镜像时候要添加 .dockerignore 文件或使用干净的工作目录。
### 碰到网络问题,无法 pull 镜像,命令行指定 http_proxy 无效?
答:在 Docker 配置文件中添加 `export http_proxy="http://<PROXY_HOST>:<PROXY_PORT>"`,之后重启 Docker 服务即可。
## 容器相关
### 容器退出后,通过 docker ps 命令查看不到,数据会丢失么?
容器退出后会处于终止exited状态此时可以通过 `docker ps -a` 查看。其中的数据也不会丢失,还可以通过 `docker start` 命令来启动它。只有删除掉容器才会清除所有数据。
### 如何停止所有正在运行的容器
答:可以使用 `docker kill $(docker ps -q)` 命令。
### 如何清理批量后台停止的容器?
答:可以使用 `docker rm -f $(docker ps -qa)` 命令。
### 如何获取某个容器的 PID 信息?
答:可以使用 `docker inspect --format '{{ .State.Pid }}' <CONTAINER ID or NAME>` 命令。
### 如何获取某个容器的 IP 地址?
答:可以使用 `docker inspect --format '{{ .NetworkSettings.IPAddress }}' <CONTAINER ID or NAME>` 命令
### 如何给容器指定一个固定 IP 地址,而不是每次重启容器 IP 地址都会变?
答:目前 Docker 并没有提供直接的对容器 IP 地址的管理支持,用户可以考虑参考第三部分中高级网络配置章节中介绍的创建点对点连接例子,来手动配置容器的静态 IP。或者在启动容器后再手动进行修改可参考其它类的问题 “*如何进入 Docker 容器的网络命名空间?*”)。
### 如何临时退出一个正在交互的容器的终端,而不终止它?
答:按 `Ctrl-p Ctrl-q`。如果按 `Ctrl-c` 往往会让容器内应用进程终止,进而会终止容器。
### 使用 `docker port` 命令映射容器的端口时系统报错“Error: No public port '80' published for xxx”
答:
* 创建镜像时 Dockerfile 要通过 EXPOSE 指定正确的开放端口;
* 容器启动时指定 `PublishAllPort = true`
### 可以在一个容器中同时运行多个应用进程么?
答:一般并不推荐在同一个容器内运行多个应用进程。如果有类似需求,可以通过一些额外的进程管理机制,比如 supervisord 来管理所运行的进程。可以参考 https://docs.docker.com/articles/using_supervisord/。
### 如何控制容器占用系统资源CPU、内存的份额
答:在使用 `docker create` 命令创建容器或使用 `docker run` 创建并启动容器的时候,可以使用 -c|--cpu-shares[=0] 参数来调整容器使用 CPU 的权重;使用 -m|--memory[=MEMORY] 参数来调整容器使用内存的大小。
## 仓库相关
### 仓库Repository、注册服务器Registry、注册索引Index 有何关系?
首先,仓库是存放一组关联镜像的集合,比如同一个应用的不同版本的镜像。
注册服务器是存放实际的镜像文件的地方。注册索引则负责维护用户的账号、权限、搜索、标签等的管理。因此,注册服务器利用注册索引来实现认证等管理。
### 从非官方仓库(例如 non-official-repo.com下载镜像时候有时候会提示“Error: Invalid registry endpoint https://non-official-repo.com/v1/……”?
Docker 自 1.3.0 版本往后,加强了对镜像安全性的验证,需要添加私有仓库证书,或者手动添加对非官方仓库的信任。
编辑 Docker 配置文件,在其中添加:
```sh
DOCKER_OPTS="--insecure-registry non-official-repo"
```
之后,重启 Docker 服务即可。
## 配置相关
### Docker 的配置文件放在哪里,如何修改配置?
答:使用 upstart 的系统如Ubuntu 14.04)的配置文件在 `/etc/default/docker`使用systemd 的系统(如 Ubuntu 16.04、Centos 等)的配置文件在 `/etc/systemd/system/docker.service.d/docker.conf`
Ubuntu 下面的配置文件内容如下,读者可以参考配。(如果出现该文件不存在的情况,重启或者自己新建一个文件都可以解决。)
```sh
# Customize location of Docker binary (especially for development testing).
#DOCKERD="/usr/local/bin/dockerd"
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"
# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"
```
### 如何更改 Docker 的默认存储位置?
Docker 的默认存储位置是 `/var/lib/docker`,如果希望将 Docker 的本地文件存储到其他分区,可以使用 Linux 软连接的方式来完成,或者在启动 daemon 时通过 `-g` 参数指定。
例如,如下操作将默认存储位置迁移到 /storage/docker。
```sh
[root@s26 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 50G 5.3G 42G 12% /
tmpfs 48G 228K 48G 1% /dev/shm
/dev/sda1 485M 40M 420M 9% /boot
/dev/mapper/VolGroup-lv_home 222G 188M 210G 1% /home
/dev/sdb2 2.7T 323G 2.3T 13% /storage
[root@s26 ~]# service docker stop
[root@s26 ~]# cd /var/lib/
[root@s26 lib]# mv docker /storage/
[root@s26 lib]# ln -s /storage/docker/ docker
[root@s26 lib]# ls -la docker
lrwxrwxrwx. 1 root root 15 11月 17 13:43 docker -> /storage/docker
[root@s26 lib]# service docker start
```
### 使用内存和 swap 限制启动容器时候报警告“WARNING: Your kernel does not support cgroup swap limit. WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.”?
答:这是因为系统默认没有开启对内存和 swap 使用的统计功能,引入该功能会带来性能的下降。要开启该功能,可以采取如下操作:
* 编辑 `/etc/default/grub` 文件Ubuntu 系统为例),配置 `GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"`
* 更新 grub`$ sudo update-grub`
* 重启系统,即可。
## Docker 与虚拟化
### Docker 与 LXCLinux Container有何不同
LXC 利用 Linux 上相关技术实现了容器。Docker 则在如下的几个方面进行了改进:
* 移植性:通过抽象容器配置,容器可以实现从一个平台移植到另一个平台;
* 镜像系统:基于 AUFS 的镜像系统为容器的分发带来了很多的便利,同时共同的镜像层只需要存储一份,实现高效率的存储;
* 版本管理类似于Git的版本管理理念用户可以更方便的创建、管理镜像文件
* 仓库系统:仓库系统大大降低了镜像的分发和管理的成本;
* 周边工具:各种现有工具(配置管理、云平台)对 Docker 的支持,以及基于 Docker的 PaaS、CI 等系统,让 Docker 的应用更加方便和多样化。
### Docker 与 Vagrant 有何不同?
答:两者的定位完全不同。
* Vagrant 类似 Boot2Docker一款运行 Docker 的最小内核是一套虚拟机的管理环境。Vagrant 可以在多种系统上和虚拟机软件中运行,可以在 WindowsMac 等非 Linux 平台上为 Docker 提供支持,自身具有较好的包装性和移植性。
* 原生的 Docker 自身只能运行在 Linux 平台上,但启动和运行的性能都比虚拟机要快,往往更适合快速开发和部署应用的场景。
简单说Vagrant 适合用来管理虚拟机,而 Docker 适合用来管理应用环境。
### 开发环境中 Docker 和 Vagrant 该如何选择?
答:
Docker 不是虚拟机,而是进程隔离,对于资源的消耗很少,但是目前需要 Linux 环境支持。Vagrant 是虚拟机上做的封装,虚拟机本身会消耗资源。
如果本地使用的 Linux 环境,推荐都使用 Docker。
如果本地使用的是 OSX 或者 Windows 环境,那就需要开虚拟机,单一开发环境下 Vagrant 更简单;多环境开发下推荐在 Vagrant 里面再使用 Docker 进行环境隔离。
## 其它
### Docker 能在非 Linux 平台(比如 Windows 或 MacOS上运行么
答:可以。目前需要使用 docker for mac、boot2docker 等软件创建一个轻量级的 Linux 虚拟机层。
### 如何将一台宿主主机的 docker 环境迁移到另外一台宿主主机
答:停止 Docker 服务。将整个 Docker 存储文件夹复制到另外一台宿主主机,然后调整另外一台宿主主机的配置即可。
### 如何进入 Docker 容器的网络命名空间?
Docker 在创建容器后,删除了宿主主机上 `/var/run/netns` 目录中的相关的网络命名空间文件。因此,在宿主主机上是无法看到或访问容器的网络命名空间的。
用户可以通过如下方法来手动恢复它。
首先使用下面的命令查看容器进程信息比如这里的1234。
```sh
$ docker inspect --format='{{. State.Pid}} ' $container_id
1234
```
接下来,在 /proc 目录下,把对应的网络命名空间文件链接到 /var/run/netns 目录。
```sh
$ sudo ln -s /proc/1234/ns/net /var/run/netns/
```
然后,在宿主主机上就可以看到容器的网络命名空间信息。例如
```sh
$ sudo ip netns show
1234
```
此时,用户可以通过正常的系统命令来查看或操作容器的命名空间了。例如修改容器的 IP 地址信息为 `172.17.0.100/16`
```sh
$ sudo ip netns exec 1234 ifconfig eth0 172.17.0.100/16
```
### 如何获取容器绑定到本地那个 veth 接口上?
Docker 容器启动后,会通过 veth 接口对连接到本地网桥veth 接口命名跟容器命名毫无关系,十分难以找到对应关系。
最简单的一种方式是通过查看接口的索引号,在容器中执行 `ip a` 命令,查看到本地接口最前面的接口索引号,如 `205`,将此值加上 1`206`,然后在本地主机执行 `ip a` 命令,查找接口索引号为 `206` 的接口,两者即为连接的 veth 接口对。

2
appendix/repo/README.md Normal file
View File

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

58
appendix/repo/centos.md Normal file
View File

@@ -0,0 +1,58 @@
## [CentOS](https://hub.docker.com/_/centos/)
### 基本信息
[CentOS](https://en.wikipedia.org/wiki/CentOS) 是流行的 Linux 发行版,其软件包大多跟 RedHat 系列保持一致。
该仓库位于 https://hub.docker.com/_/centos/,提供了 CentOS 从 5 ~ 7 各个版本的镜像。
### 使用方法
默认会启动一个最小化的 CentOS 环境。
```sh
$ docker run --name some-centos -i -t centos bash
bash-4.2#
```
### Dockerfile
#### CentOS 5 版本
```
FROM scratch
MAINTAINER The CentOS Project <cloud-ops@centos.org>
ADD c5-docker.tar.xz /
LABEL name="CentOS Base Image" \
vendor="CentOS" \
license="GPLv2" \
build-date="2016-03-31"
# Default command
CMD ["/bin/bash"]
```
#### CentOS 6 版本
```
FROM scratch
MAINTAINER https://github.com/CentOS/sig-cloud-instance-images
ADD centos-6-docker.tar.xz /
LABEL name="CentOS Base Image" \
vendor="CentOS" \
license="GPLv2" \
build-date="20160729"
CMD ["/bin/bash"]
```
#### CentOS 7 版本
```
FROM scratch
MAINTAINER https://github.com/CentOS/sig-cloud-instance-images
ADD centos-7-docker.tar.xz /
LABEL name="CentOS Base Image" \
vendor="CentOS" \
license="GPLv2" \
build-date="20160729"
CMD ["/bin/bash"]
```

263
appendix/repo/mongodb.md Normal file
View File

@@ -0,0 +1,263 @@
## [MongoDB](https://hub.docker.com/_/mongo/)
### 基本信息
[MongoDB](https://en.wikipedia.org/wiki/MongoDB) 是开源的 NoSQL 数据库实现。
该仓库位于 https://hub.docker.com/_/mongo/,提供了 MongoDB 2.x ~ 3.x 各个版本的镜像。
### 使用方法
默认会在 `27017` 端口启动数据库。
```sh
$ docker run --name some-mongo -d mongo
```
使用其他应用连接到容器,可以用
```sh
$ docker run --name some-app --link some-mongo:mongo -d application-that-uses-mongo
```
或者通过 `mongo`
```sh
$ 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.6 版本
```
FROM debian:wheezy
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates wget \
numactl \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true
ENV MONGO_VERSION 2.6.12
RUN set -x \
&& wget -O mongo.tgz "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGO_VERSION.tgz" \
&& wget -O mongo.tgz.sig "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGO_VERSION.tgz.sig" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys DFFA3DCF326E302C4787673A01C4E7FAAAB2461C \
&& gpg --batch --verify mongo.tgz.sig mongo.tgz \
&& rm -r "$GNUPGHOME" mongo.tgz.sig \
&& tar -xvf mongo.tgz -C /usr/local --strip-components=1 \
&& rm mongo.tgz
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb
VOLUME /data/db /data/configdb
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 27017
CMD ["mongod"]
```
#### 3.0 版本
```
FROM debian:wheezy
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
numactl \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apt-get purge -y --auto-remove ca-certificates wget
# gpg: key 7F0CEB10: public key "Richard Kreuter <richard@10gen.com>" imported
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 492EAFE8CD016A07919F1D2B9ECBEC467F0CEB10
ENV MONGO_MAJOR 3.0
ENV MONGO_VERSION 3.0.12
RUN echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/$MONGO_MAJOR main" > /etc/apt/sources.list.d/mongodb-org.list
RUN set -x \
&& apt-get update \
&& apt-get install -y \
mongodb-org=$MONGO_VERSION \
mongodb-org-server=$MONGO_VERSION \
mongodb-org-shell=$MONGO_VERSION \
mongodb-org-mongos=$MONGO_VERSION \
mongodb-org-tools=$MONGO_VERSION \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mongodb \
&& mv /etc/mongod.conf /etc/mongod.conf.orig
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb
VOLUME /data/db /data/configdb
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 27017
CMD ["mongod"]
```
#### 3.2 版本
```
FROM debian:wheezy
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
numactl \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apt-get purge -y --auto-remove ca-certificates wget
# pub 4096R/AAB2461C 2014-02-25 [expires: 2016-02-25]
# Key fingerprint = DFFA 3DCF 326E 302C 4787 673A 01C4 E7FA AAB2 461C
# uid MongoDB 2.6 Release Signing Key <packaging@mongodb.com>
#
# pub 4096R/EA312927 2015-10-09 [expires: 2017-10-08]
# Key fingerprint = 42F3 E95A 2C4F 0827 9C49 60AD D68F A50F EA31 2927
# uid MongoDB 3.2 Release Signing Key <packaging@mongodb.com>
#
ENV GPG_KEYS \
DFFA3DCF326E302C4787673A01C4E7FAAAB2461C \
42F3E95A2C4F08279C4960ADD68FA50FEA312927
RUN set -ex \
&& for key in $GPG_KEYS; do \
apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done
ENV MONGO_MAJOR 3.2
ENV MONGO_VERSION 3.2.8
RUN echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/$MONGO_MAJOR main" > /etc/apt/sources.list.d/mongodb-org.list
RUN set -x \
&& apt-get update \
&& apt-get install -y \
mongodb-org=$MONGO_VERSION \
mongodb-org-server=$MONGO_VERSION \
mongodb-org-shell=$MONGO_VERSION \
mongodb-org-mongos=$MONGO_VERSION \
mongodb-org-tools=$MONGO_VERSION \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mongodb \
&& mv /etc/mongod.conf /etc/mongod.conf.orig
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb
VOLUME /data/db /data/configdb
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 27017
CMD ["mongod"]
```
#### 3.3 版本
```
FROM debian:jessie
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
numactl \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true \
&& apt-get purge -y --auto-remove ca-certificates wget
# pub 4096R/A15703C6 2016-01-11 [expires: 2018-01-10]
# Key fingerprint = 0C49 F373 0359 A145 1858 5931 BC71 1F9B A157 03C6
# uid MongoDB 3.4 Release Signing Key <packaging@mongodb.com>
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 0C49F3730359A14518585931BC711F9BA15703C6
ENV MONGO_MAJOR 3.3
ENV MONGO_VERSION 3.3.10
RUN echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/$MONGO_MAJOR main" > /etc/apt/sources.list.d/mongodb-org.list
RUN set -x \
&& apt-get update \
&& apt-get install -y \
mongodb-org-unstable=$MONGO_VERSION \
mongodb-org-unstable-server=$MONGO_VERSION \
mongodb-org-unstable-shell=$MONGO_VERSION \
mongodb-org-unstable-mongos=$MONGO_VERSION \
mongodb-org-unstable-tools=$MONGO_VERSION \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mongodb \
&& mv /etc/mongod.conf /etc/mongod.conf.orig
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb
VOLUME /data/db /data/configdb
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 27017
CMD ["mongod"]
```

124
appendix/repo/mysql.md Normal file
View File

@@ -0,0 +1,124 @@
## [MySQL](https://hub.docker.com/_/mysql/)
### 基本信息
[MySQL](https://en.wikipedia.org/wiki/MySQL) 是开源的关系数据库实现。
该仓库位于 https://hub.docker.com/_/mysql/,提供了 MySQL 各个版本的镜像,包括 5.6 系列、5.7 系列等。
### 使用方法
默认会在 `3306` 端口启动数据库。
```
$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql
```
之后就可以使用其它应用来连接到该容器。
```
$ docker run --name some-app --link some-mysql:mysql -d application-that-uses-mysql
```
或者通过 `mysql`
```
$ 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 版本
```
FROM debian:wheezy
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
# File::Basename
# File::Copy
# Sys::Hostname
# Data::Dumper
RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/*
# mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
RUN apt-get update && apt-get install -y libaio1 && rm -rf /var/lib/apt/lists/*
# gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
RUN gpg --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
ENV MYSQL_MAJOR 5.6
ENV MYSQL_VERSION 5.6.20
# note: we're pulling the *.asc file from mysql.he.net instead of dev.mysql.com because the official mirror 404s that file for whatever reason - maybe it's at a different path?
RUN apt-get update && apt-get install -y curl --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SL "http://dev.mysql.com/get/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz" -o mysql.tar.gz \
&& curl -SL "http://mysql.he.net/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz.asc" -o mysql.tar.gz.asc \
&& apt-get purge -y --auto-remove curl \
&& gpg --verify mysql.tar.gz.asc \
&& mkdir /usr/local/mysql \
&& tar -xzf mysql.tar.gz -C /usr/local/mysql --strip-components=1 \
&& rm mysql.tar.gz* \
&& rm -rf /usr/local/mysql/mysql-test /usr/local/mysql/sql-bench \
&& rm -rf /usr/local/mysql/bin/*-debug /usr/local/mysql/bin/*_embedded \
&& find /usr/local/mysql -type f -name "*.a" -delete \
&& apt-get update && apt-get install -y binutils && rm -rf /var/lib/apt/lists/* \
&& { find /usr/local/mysql -type f -executable -exec strip --strip-all '{}' + || true; } \
&& apt-get purge -y --auto-remove binutils
ENV PATH $PATH:/usr/local/mysql/bin:/usr/local/mysql/scripts
WORKDIR /usr/local/mysql
VOLUME /var/lib/mysql
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 3306
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mysql"]
```
#### 5.7 版本
```
FROM debian:wheezy
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
# File::Basename
# File::Copy
# Sys::Hostname
# Data::Dumper
RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/*
# mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
RUN apt-get update && apt-get install -y libaio1 && rm -rf /var/lib/apt/lists/*
# gpg: key 5072E1F5: public key "MySQL Release Engineering <mysql-build@oss.oracle.com>" imported
RUN gpg --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5
ENV MYSQL_MAJOR 5.7
ENV MYSQL_VERSION 5.7.4-m14
# note: we're pulling the *.asc file from mysql.he.net instead of dev.mysql.com because the official mirror 404s that file for whatever reason - maybe it's at a different path?
RUN apt-get update && apt-get install -y curl --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SL "http://dev.mysql.com/get/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz" -o mysql.tar.gz \
&& curl -SL "http://mysql.he.net/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz.asc" -o mysql.tar.gz.asc \
&& apt-get purge -y --auto-remove curl \
&& gpg --verify mysql.tar.gz.asc \
&& mkdir /usr/local/mysql \
&& tar -xzf mysql.tar.gz -C /usr/local/mysql --strip-components=1 \
&& rm mysql.tar.gz* \
&& rm -rf /usr/local/mysql/mysql-test /usr/local/mysql/sql-bench \
&& rm -rf /usr/local/mysql/bin/*-debug /usr/local/mysql/bin/*_embedded \
&& find /usr/local/mysql -type f -name "*.a" -delete \
&& apt-get update && apt-get install -y binutils && rm -rf /var/lib/apt/lists/* \
&& { find /usr/local/mysql -type f -executable -exec strip --strip-all '{}' + || true; } \
&& apt-get purge -y --auto-remove binutils
ENV PATH $PATH:/usr/local/mysql/bin:/usr/local/mysql/scripts
WORKDIR /usr/local/mysql
VOLUME /var/lib/mysql
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 3306
CMD ["mysqld", "--datadir=/var/lib/mysql", "--user=mysql"]
```

101
appendix/repo/nginx.md Normal file
View File

@@ -0,0 +1,101 @@
## [Nginx](https://hub.docker.com/_/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 各个版本的镜像。
### 使用方法
下面的命令将作为一个静态页面服务器启动。
```
$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx
```
用户也可以不使用这种映射方式,通过利用 Dockerfile 来直接将静态页面内容放到镜像中,内容为
```
FROM nginx
COPY static-html-directory /usr/share/nginx/html
```
之后生成新的镜像,并启动一个容器。
```
$ docker build -t some-content-nginx .
$ docker run --name some-nginx -d some-content-nginx
```
开放端口,并映射到本地的 `8080` 端口。
```
docker run --name some-nginx -d -p 8080:80 some-content-nginx
```
Nginx的默认配置文件路径为 `/etc/nginx/nginx.conf`,可以通过映射它来使用本地的配置文件,例如
```
docker run --name some-nginx -v /some/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
```
使用配置文件时,为了在容器中正常运行,需要保持 `daemon off;`
### Dockerfile
#### stable 版本
```
FROM debian:jessie
MAINTAINER NGINX Docker Maintainers "docker-maint@nginx.com"
ENV NGINX_VERSION 1.10.1-1~jessie
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
&& echo "deb http://nginx.org/packages/debian/ jessie nginx" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
ca-certificates \
nginx=${NGINX_VERSION} \
nginx-module-xslt \
nginx-module-geoip \
nginx-module-image-filter \
nginx-module-perl \
nginx-module-njs \
gettext-base \
&& rm -rf /var/lib/apt/lists/*
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
```
#### 1.11.x 版本
```
FROM debian:jessie
MAINTAINER NGINX Docker Maintainers "docker-maint@nginx.com"
ENV NGINX_VERSION 1.11.1-1~jessie
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
&& echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
ca-certificates \
nginx=${NGINX_VERSION} \
nginx-module-xslt \
nginx-module-geoip \
nginx-module-image-filter \
nginx-module-perl \
nginx-module-njs \
gettext-base \
&& rm -rf /var/lib/apt/lists/*
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
```

151
appendix/repo/nodejs.md Normal file
View File

@@ -0,0 +1,151 @@
## [Node.js](https://hub.docker.com/_/node/)
### 基本信息
[Node.js](https://en.wikipedia.org/wiki/Node.js)是基于 JavaScript 的可扩展服务端和网络软件开发平台。
该仓库位于 https://hub.docker.com/_/node/,提供了 Node.js 0.10 ~ 6.3.x 各个版本的镜像。
### 使用方法
在项目中创建一个 Dockerfile。
```
FROM node:0.10-onbuild
# replace this with your application's default port
EXPOSE 8888
```
然后创建镜像,并启动容器。
```
$ docker build -t my-nodejs-app
$ docker run -it --rm --name my-running-app my-nodejs-app
```
也可以直接运行一个简单容器。
```
$ docker run -it --rm --name my-running-script -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp node:0.10 node your-daemon-or-script.js
```
### Dockerfile
#### 0.10 版本
```
FROM buildpack-deps
RUN apt-get update && apt-get install -y \
ca-certificates \
curl
# verify gpg and sha256: http://nodejs.org/dist/v0.10.31/SHASUMS256.txt.asc
# gpg: aka "Timothy J Fontaine (Work) <tj.fontaine@joyent.com>"
RUN gpg --keyserver pgp.mit.edu --recv-keys 7937DFD2AB06298B2293C3187D33FF9D0246406D
ENV NODE_VERSION 0.10.32
RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --verify SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc
CMD [ "node" ]
```
#### 4.x 版本
```
FROM buildpack-deps:jessie
# gpg keys listed at https://github.com/nodejs/node
RUN set -ex \
&& for key in \
9554F04D7259F04124DE6B476D5A82AC7E37093B \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 4.4.7
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
CMD [ "node" ]
```
#### 5.x 版本
```
FROM buildpack-deps:jessie
# gpg keys listed at https://github.com/nodejs/node
RUN set -ex \
&& for key in \
9554F04D7259F04124DE6B476D5A82AC7E37093B \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 5.12.0
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
CMD [ "node" ]
```
#### 6.x 版本
```
FROM buildpack-deps:jessie
# gpg keys listed at https://github.com/nodejs/node
RUN set -ex \
&& for key in \
9554F04D7259F04124DE6B476D5A82AC7E37093B \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done
ENV NPM_CONFIG_LOGLEVEL info
ENV NODE_VERSION 6.3.1
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
CMD [ "node" ]
```

141
appendix/repo/redis.md Normal file
View File

@@ -0,0 +1,141 @@
## [Redis](https://hub.docker.com/_/redis/)
### 基本信息
[Redis](https://en.wikipedia.org/wiki/Redis) 是开源的内存 Key-Value 数据库实现。
该仓库位于 https://hub.docker.com/_/redis/,提供了 Redis 3.x 各个版本的镜像。
### 使用方法
默认会在 `6379` 端口启动数据库。
```
$ docker run --name some-redis -d redis
```
另外还可以启用 [持久存储](http://redis.io/topics/persistence)。
```
$ docker run --name some-redis -d redis redis-server --appendonly yes
```
默认数据存储位置在 `VOLUME/data`。可以使用 `--volumes-from some-volume-container``-v /docker/host/dir:/data` 将数据存放到本地。
使用其他应用连接到容器,可以用
```
$ docker run --name some-app --link some-redis:redis -d application-that-uses-redis
```
或者通过 `redis-cli`
```
$ 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
#### 3.0 版本
```
FROM debian:jessie
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r redis && useradd -r -g redis redis
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
wget \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true
ENV REDIS_VERSION 3.0.7
ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-3.0.7.tar.gz
ENV REDIS_DOWNLOAD_SHA1 e56b4b7e033ae8dbf311f9191cf6fdf3ae974d1c
# for redis-sentinel see: http://redis.io/topics/sentinel
RUN buildDeps='gcc libc6-dev make' \
&& set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL" \
&& echo "$REDIS_DOWNLOAD_SHA1 *redis.tar.gz" | sha1sum -c - \
&& mkdir -p /usr/src/redis \
&& tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1 \
&& rm redis.tar.gz \
&& make -C /usr/src/redis \
&& make -C /usr/src/redis install \
&& rm -r /usr/src/redis \
&& apt-get purge -y --auto-remove $buildDeps
RUN mkdir /data && chown redis:redis /data
VOLUME /data
WORKDIR /data
COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 6379
CMD [ "redis-server" ]
```
#### 3.2 版本
```
FROM debian:jessie
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r redis && useradd -r -g redis redis
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
wget \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true
ENV REDIS_VERSION 3.2.3
ENV REDIS_DOWNLOAD_URL http://download.redis.io/releases/redis-3.2.3.tar.gz
ENV REDIS_DOWNLOAD_SHA1 92d6d93ef2efc91e595c8bf578bf72baff397507
# for redis-sentinel see: http://redis.io/topics/sentinel
RUN buildDeps='gcc libc6-dev make' \
&& set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL" \
&& echo "$REDIS_DOWNLOAD_SHA1 *redis.tar.gz" | sha1sum -c - \
&& mkdir -p /usr/src/redis \
&& tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1 \
&& rm redis.tar.gz \
&& make -C /usr/src/redis \
&& make -C /usr/src/redis install \
&& rm -r /usr/src/redis \
&& apt-get purge -y --auto-remove $buildDeps
RUN mkdir /data && chown redis:redis /data
VOLUME /data
WORKDIR /data
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 6379
CMD [ "redis-server" ]
```

142
appendix/repo/ubuntu.md Normal file
View File

@@ -0,0 +1,142 @@
## [Ubuntu](https://hub.docker.com/_/ubuntu/)
### 基本信息
[Ubuntu](https://en.wikipedia.org/wiki/Ubuntu) 是流行的 Linux 发行版,其自带软件版本往往较新一些。
该仓库位于 https://hub.docker.com/_/ubuntu/,提供了 Ubuntu 从 12.04 ~ 16.10 各个版本的镜像。
### 使用方法
默认会启动一个最小化的 Ubuntu 环境。
```
$ docker run --name some-ubuntu -i -t ubuntu
root@523c70904d54:/#
```
### Dockerfile
#### 12.04 版本
```
FROM scratch
ADD precise-core-amd64.tar.gz /
# a few minor docker-specific tweaks
# see https://github.com/dotcloud/docker/blob/master/contrib/mkimage/debootstrap
RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \
&& chmod +x /usr/sbin/policy-rc.d \
\
&& dpkg-divert --local --rename --add /sbin/initctl \
&& cp -a /usr/sbin/policy-rc.d /sbin/initctl \
&& sed -i 's/^exit.*/exit 0/' /sbin/initctl \
\
&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup \
\
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean \
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean \
&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \
\
&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages \
\
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes
# delete all the apt list files since they're big and get stale quickly
RUN rm -rf /var/lib/apt/lists/*
# this forces "apt-get update" in dependent images, which is also good
# enable the universe
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
# upgrade packages for now, since the tarballs aren't updated frequently enough
RUN apt-get update && apt-get dist-upgrade -y && rm -rf /var/lib/apt/lists/*
# overwrite this with 'CMD []' in a dependent Dockerfile
CMD ["/bin/bash"]
```
#### 14.04 版本
```
FROM scratch
ADD trusty-core-amd64.tar.gz /
# a few minor docker-specific tweaks
# see https://github.com/dotcloud/docker/blob/master/contrib/mkimage/debootstrap
RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \
&& chmod +x /usr/sbin/policy-rc.d \
\
&& dpkg-divert --local --rename --add /sbin/initctl \
&& cp -a /usr/sbin/policy-rc.d /sbin/initctl \
&& sed -i 's/^exit.*/exit 0/' /sbin/initctl \
\
&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup \
\
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean \
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean \
&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \
\
&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages \
\
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes
# delete all the apt list files since they're big and get stale quickly
RUN rm -rf /var/lib/apt/lists/*
# this forces "apt-get update" in dependent images, which is also good
# enable the universe
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
# upgrade packages for now, since the tarballs aren't updated frequently enough
RUN apt-get update && apt-get dist-upgrade -y && rm -rf /var/lib/apt/lists/*
# overwrite this with 'CMD []' in a dependent Dockerfile
CMD ["/bin/bash"]
```
#### 16.04 版本
```
FROM scratch
ADD ubuntu-xenial-core-cloudimg-amd64-root.tar.gz /
# a few minor docker-specific tweaks
# see https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap
RUN set -xe \
\
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L40-L48
&& echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \
&& chmod +x /usr/sbin/policy-rc.d \
\
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L54-L56
&& dpkg-divert --local --rename --add /sbin/initctl \
&& cp -a /usr/sbin/policy-rc.d /sbin/initctl \
&& sed -i 's/^exit.*/exit 0/' /sbin/initctl \
\
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L71-L78
&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/docker-apt-speedup \
\
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L85-L105
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/docker-clean \
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/docker-clean \
&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/docker-clean \
\
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L109-L115
&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/docker-no-languages \
\
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L118-L130
&& echo 'Acquire::GzipIndexes "true"; Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/docker-gzip-indexes \
\
# https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap#L134-L151
&& echo 'Apt::AutoRemove::SuggestsImportant "false";' > /etc/apt/apt.conf.d/docker-autoremove-suggests
# delete all the apt list files since they're big and get stale quickly
RUN rm -rf /var/lib/apt/lists/*
# this forces "apt-get update" in dependent images, which is also good
# enable the universe
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
# overwrite this with 'CMD []' in a dependent Dockerfile
CMD ["/bin/bash"]
```

117
appendix/repo/wordpress.md Normal file
View File

@@ -0,0 +1,117 @@
## [WordPress](https://hub.docker.com/_/wordpress/)
### 基本信息
[WordPress](https://en.wikipedia.org/wiki/WordPress) 是开源的 Blog 和内容管理系统框架,它基于 PhP 和 MySQL。
该仓库位于 https://hub.docker.com/_/wordpress/,提供了 WordPress 4.x 版本的镜像。
### 使用方法
启动容器需要 MySQL 的支持,默认端口为 `80`
```
$ 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 串
### Dockerfile
#### 4.0 版本
```
FROM debian:wheezy
RUN apt-get update && apt-get install -y \
apache2 \
curl \
libapache2-mod-php5 \
php5-curl \
php5-gd \
php5-mysql \
rsync \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN a2enmod rewrite
# copy a few things from apache's init script that it requires to be setup
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
# and then a few more from $APACHE_CONFDIR/envvars itself
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_PID_FILE $APACHE_RUN_DIR/apache2.pid
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_LOG_DIR /var/log/apache2
ENV LANG C
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR
# make CustomLog (access log) go to stdout instead of files
# and ErrorLog to stderr
RUN find "$APACHE_CONFDIR" -type f -exec sed -ri ' \
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
' '{}' ';'
RUN rm -rf /var/www/html && mkdir /var/www/html
VOLUME /var/www/html
WORKDIR /var/www/html
ENV WORDPRESS_VERSION 4.0.0
ENV WORDPRESS_UPSTREAM_VERSION 4.0
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
RUN curl -SL http://wordpress.org/wordpress-${WORDPRESS_UPSTREAM_VERSION}.tar.gz | tar -xzC /usr/src/
COPY docker-apache.conf /etc/apache2/sites-available/wordpress
RUN a2dissite 000-default && a2ensite wordpress
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 80
CMD ["apache2", "-DFOREGROUND"]
```
#### 4.5 版本
```
FROM php:5.6-apache
RUN a2enmod rewrite expires
# install the PHP extensions we need
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd mysqli opcache
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
VOLUME /var/www/html
ENV WORDPRESS_VERSION 4.5.3
ENV WORDPRESS_SHA1 835b68748dae5a9d31c059313cd0150f03a49269
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \
&& echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \
&& tar -xzf wordpress.tar.gz -C /usr/src/ \
&& rm wordpress.tar.gz \
&& chown -R www-data:www-data /usr/src/wordpress
COPY docker-entrypoint.sh /entrypoint.sh
# grr, ENTRYPOINT resets CMD now
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]
```

View File

@@ -0,0 +1,23 @@
# 资源链接
## 官方网站
* Docker 官方主页: https://www.docker.com
* Docker 官方博客: https://blog.docker.com/
* Docker 官方文档: https://docs.docker.com/
* Docker Hub: https://hub.docker.com
* Docker 的源代码仓库: https://github.com/docker/docker
* Docker 发布版本历史https://docs.docker.com/release-notes/
* Docker 常见问题https://docs.docker.com/engine/faq/
* Docker 远端应用 API: https://docs.docker.com/reference/api/docker_remote_api/
## 实践参考
* Dockerfile 参考https://docs.docker.com/reference/builder/
* Dockerfile 最佳实践https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
## 技术交流
* Docker 邮件列表: https://groups.google.com/forum/#!forum/docker-user
* Docker 的 IRC 频道: https://chat.freenode.net#docker
* Docker 的 Twitter 主页: https://twitter.com/docker
## 其它
* Docker 的 StackOverflow 问答主页: https://stackoverflow.com/search?q=docker

126
appendix_command/README.md Normal file
View File

@@ -0,0 +1,126 @@
# Docker命令查询
## 基本语法
Docker 命令有两大类,客户端命令和服务端命令。前者是主要的操作接口,后者用来启动 Docker daemon。
* 客户端命令:基本命令格式为 `docker [OPTIONS] COMMAND [arg...]`
* 服务端命令:基本命令格式为 `docker daemon [OPTIONS]`
可以通过 `man docker``docker help` 来查看这些命令。
## 客户端命令选项
* --config="":指定客户端配置文件,默认为 `/.docker`
* -D=true|false是否使用 debug 模式。默认不开启;
* -H, --host=[]:指定命令对应 Docker daemon 的监听接口,可以为 unix 套接字unix:///path/to/socket文件句柄fd://socketfd或 tcp 套接字tcp://[host[:port]]),默认为 unix:///var/run/docker.sock
* -l, --log-level="debug|info|warn|error|fatal":指定日志输出级别;
* --tls=true|false是否对 Docker daemon 启用 TLS 安全机制,默认为否;
* --tlscacert= /.docker/ca.pemTLS CA 签名的可信证书文件路径;
* --tlscert= /.docker/cert.pemTLS 可信证书文件路径;
* --tlscert= /.docker/key.pemTLS 密钥文件路径;
* --tlsverify=true|false启用 TLS 校验,默认为否。
## daemon 命令选项
* --api-cors-header=""CORS 头部域,默认不允许 CORS要允许任意的跨域访问可以指定为 “*”;
* --authorization-plugin="":载入认证的插件;
* -b="":将容器挂载到一个已存在的网桥上。指定为 'none' 时则禁用容器的网络,与 --bip 选项互斥;
* --bip="":让动态创建的 docker0 网桥采用给定的 CIDR 地址; 与 -b 选项互斥;
* --cgroup-parent="":指定 cgroup 的父组,默认 fs cgroup 驱动为 `/docker`systemd cgroup 驱动为 `system.slice`
* --cluster-store="":构成集群(如 Swarm集群键值数据库服务地址
* --cluster-advertise="":构成集群时,自身的被访问地址,可以为 `host:port``interface:port`
* --cluster-store-opt="":构成集群时,键值数据库的配置选项;
* --config-file="/etc/docker/daemon.json"daemon 配置文件路径;
* --containerd=""containerd 文件的路径;
* -D, --debug=true|false是否使用 Debug 模式。缺省为 false
* --default-gateway="":容器的 IPv4 网关地址,必须在网桥的子网段内;
* --default-gateway-v6="":容器的 IPv6 网关地址;
* --default-ulimit=[]:默认的 ulimit 值;
* --disable-legacy-registry=true|false是否允许访问旧版本的镜像仓库服务器
* --dns="":指定容器使用的 DNS 服务器地址;
* --dns-opt=""DNS 选项;
* --dns-search=[]DNS 搜索域;
* --exec-opt=[]:运行时的执行选项;
* --exec-root="":容器执行状态文件的根路径,默认为 `/var/run/docker`
* --fixed-cidr="":限定分配 IPv4 地址范围;
* --fixed-cidr-v6="":限定分配 IPv6 地址范围;
* -G, --group="":分配给 unix 套接字的组,默认为 `docker`
* -g, --graph=""Docker 运行时的根路径,默认为 `/var/lib/docker`
* -H, --host=[]:指定命令对应 Docker daemon 的监听接口,可以为 unix 套接字unix:///path/to/socket文件句柄fd://socketfd或 tcp 套接字tcp://[host[:port]]),默认为 unix:///var/run/docker.sock
* --icc=true|false是否启用容器间以及跟 daemon 所在主机的通信。默认为 true。
* --insecure-registry=[]:允许访问给定的非安全仓库服务;
* --ip="":绑定容器端口时候的默认 IP 地址。缺省为 0.0.0.0
* --ip-forward=true|false是否检查启动在 Docker 主机上的启用 IP 转发服务,默认开启。注意关闭该选项将不对系统转发能力进行任何检查修改;
* --ip-masq=true|false是否进行地址伪装用于容器访问外部网络默认开启
* --iptables=true|false是否允许 Docker 添加 iptables 规则。缺省为 true
* --ipv6=true|false是否启用 IPv6 支持,默认关闭;
* -l, --log-level="debug|info|warn|error|fatal":指定日志输出级别;
* --label="[]":添加指定的键值对标注;
* --log-driver="json-file|syslog|journald|gelf|fluentd|awslogs|splunk|etwlogs|gcplogs|none":指定日志后端驱动,默认为 json-file
* --log-opt=[]:日志后端的选项;
* --mtu=VALUE指定容器网络的 mtu
* -p="":指定 daemon 的 PID 文件路径。缺省为 `/var/run/docker.pid`
* --raw-logs输出原始未加色彩的日志信息
* --registry-mirror=<scheme>://<host>:指定 `docker pull` 时使用的注册服务器镜像地址;
* -s, --storage-driver="":指定使用给定的存储后端;
* --selinux-enabled=true|false是否启用 SELinux 支持。缺省值为 false。SELinux 目前尚不支持 overlay 存储驱动;
* --storage-opt=[]:驱动后端选项;
* --tls=true|false是否对 Docker daemon 启用 TLS 安全机制,默认为否;
* --tlscacert= /.docker/ca.pemTLS CA 签名的可信证书文件路径;
* --tlscert= /.docker/cert.pemTLS 可信证书文件路径;
* --tlscert= /.docker/key.pemTLS 密钥文件路径;
* --tlsverify=true|false启用 TLS 校验,默认为否;
* --userland-proxy=true|false是否使用用户态代理来实现容器间和出容器的回环通信默认为 true
* --userns-remap=default|uid:gid|user:group|user|uid指定容器的用户命名空间默认是创建新的 UID 和 GID 映射到容器内进程。
## 子命令
可以通过 `man docker-COMMAND` 来查看这些命令的具体用法。
* attach依附到一个正在运行的容器中
* build从一个 Dockerfile 创建一个镜像;
* commit从一个容器的修改中创建一个新的镜像
* cp在容器和本地宿主系统之间复制文件中
* create创建一个新容器但并不运行它
* diff检查一个容器文件系统的修改
* events从服务端获取实时的事件
* exec在运行的容器内执行命令
* export导出容器内容为一个 tar 包;
* history显示一个镜像的历史信息
* images列出存在的镜像
* import导入一个文件典型为 tar 包)路径或目录来创建一个本地镜像;
* info显示一些相关的系统信息
* inspect显示一个容器的具体配置信息
* kill关闭一个运行中的容器 (包括进程和所有相关资源)
* load从一个 tar 包中加载一个镜像;
* login注册或登录到一个 Docker 的仓库服务器;
* logout从 Docker 的仓库服务器登出;
* logs获取容器的 log 信息;
* network管理 Docker 的网络,包括查看、创建、删除、挂载、卸载等;
* node管理 swarm 集群中的节点,包括查看、更新、删除、提升/取消管理节点等;
* pause暂停一个容器中的所有进程
* port查找一个 nat 到一个私有网口的公共口;
* ps列出主机上的容器
* pull从一个Docker的仓库服务器下拉一个镜像或仓库
* push将一个镜像或者仓库推送到一个 Docker 的注册服务器;
* rename重命名一个容器
* restart重启一个运行中的容器
* rm删除给定的若干个容器
* rmi删除给定的若干个镜像
* run创建一个新容器并在其中运行给定命令
* save保存一个镜像为 tar 包文件;
* search在 Docker index 中搜索一个镜像;
* service管理 Docker 所启动的应用服务,包括创建、更新、删除等;
* start启动一个容器
* stats输出一个或多个容器的资源使用统计信息
* stop终止一个运行中的容器
* swarm管理 Docker swarm 集群,包括创建、加入、退出、更新等;
* tag为一个镜像打标签
* top查看一个容器中的正在运行的进程信息
* unpause将一个容器内所有的进程从暂停状态中恢复
* update更新指定的若干容器的配置信息
* version输出 Docker 的版本信息;
* volume管理 Docker volume包括查看、创建、删除等
* wait阻塞直到一个容器终止然后输出它的退出符。
## 一张图总结 Docker 的命令
![命令周期](../_images/cmd_logic.png)

View File

@@ -1,7 +0,0 @@
#架构
docker使用C/S架构docker daemon作为server端接受client的请求并处理创建、运行、分发容器他们可以运行在一个机器上也通过sockerts或者RESTful API通信。
![Docker基本架构](../images/docker_arch.png)
Docker daemon一般在宿主主机后台运行用户使用client而直接跟daemon交互。Docker client 以系统做bin命令的形式存在用户用docker命令来跟docker daemon交互。

View File

@@ -1,9 +0,0 @@
当我们运行`docker run -i -t ubuntu /bin/bash`命令时docker 在后台运行的操作如下:
* 如果本地有ubuntu这个image就从它创建容器否则从公有仓库下载
* 从image创建容器
* 分配一个文件系统并在只读的image层外面挂载一层可读写的层
* 从宿主主机配置的网桥接口中桥接一个虚拟接口到容器中去
* 从地址池配置一个ip地址给容器
* 执行你指定的程序,在这里启动一个/bin/bash进程
* -i -t 指定标准输入和输出

View File

@@ -1,3 +0,0 @@
每个docker都有很多层次构成docker使用 union file systems 将这些不同的层结合到一个image中去。
AUFS (AnotherUnionFS) 是一种 Union FS, 简单来说就是支持将不同目录挂载到同一个虚拟文件系统下(unite several directories into a single virtual filesystem)的文件系统, 更进一步的理解, AUFS支持为每一个成员目录(类似Git Branch)设定readonly、readwrite 和 whiteout-able 权限, 同时 AUFS 里有一个类似分层的概念, 对 readonly 权限的 branch 可以逻辑上进行修改(增量地, 不影响 readonly 部分的)。通常 Union FS 有两个用途, 一方面可以实现不借助 LVM、RAID 将多个disk挂到同一个目录下, 另一个更常用的就是将一个 readonly 的 branch 和一个 writeable 的 branch 联合在一起Live CD正是基于此方法可以允许在 OS image 不变的基础上允许用户在其上进行一些写操作。Docker 在 AUFS 上构建的 container image 也正是如此。

View File

@@ -1,13 +0,0 @@
docker有三个内部组件
* docker images
* docker registries
* docker containers
### Docker images
docker images 就是一个只读的模板。比如一个image可以包含一个ubuntu的操作系统里面安装了apache或者你需要的应用程序。images可以用来创建docker containersdocker提供了一个很简单的机制来创建images或者更新现有的images你甚至可以直接从其他人那里下载一个已经做好的images
###Docker registries
Docker registries 也叫docker 仓库它有公有仓库和私有仓库2种形式他们都可以用来让你上传和下载images。公有的仓库也叫 Docker Hub。它提供了一个巨大的image库可以让你下载你也可以在自己的局域网内建一个自己的私有仓库。
###Docker containers
Docker containers也叫docker容器容器是从image镜像创建的。它可以被启动、开始、停止、删除。每个容器都是相互隔离的、安全的平台。

View File

@@ -1 +0,0 @@
docker仓库用来保存我们的images当我们创建了自己的image之后我们就可以使用push命令将它上传到公有或者私有仓库这样下次要在另外一台机器上使用这个image时候只需要从仓库上pull下来就可以了。

View File

@@ -1,23 +0,0 @@
docker底层的2个核心技术分别是Namespaces和Control groups。
以下内容摘自InfoQ Docker自1.20版本开始docker已经抛开lxc不过下面的内容对于理解docker还是有很大帮助。
###pid namespace
不同用户的进程就是通过pid namespace隔离开的且不同 namespace 中可以有相同pid。所有的LXC进程在docker中的父进程为docker进程每个lxc进程具有不同的namespace。同时由于允许嵌套因此可以很方便的实现 Docker in Docker。
###net namespace
有了 pid namespace, 每个namespace中的pid能够相互隔离但是网络端口还是共享host的端口。网络隔离是通过net namespace实现的 每个net namespace有独立的 network devices, IP addresses, IP routing tables, /proc/net 目录。这样每个container的网络就能隔离开来。docker默认采用veth的方式将container中的虚拟网卡同host上的一个docker bridge: docker0连接在一起。
###ipc namespace
container中进程交互还是采用linux常见的进程间交互方法(interprocess communication - IPC), 包括常见的信号量、消息队列和共享内存。然而同 VM 不同的是container 的进程间交互实际上还是host上具有相同pid namespace中的进程间交互因此需要在IPC资源申请时加入namespace信息 - 每个IPC资源有一个唯一的 32 位 ID。
###mnt namespace
类似chroot将一个进程放到一个特定的目录执行。mnt namespace允许不同namespace的进程看到的文件结构不同这样每个 namespace 中的进程所看到的文件目录就被隔离开了。同chroot不同每个namespace中的container在/proc/mounts的信息只包含所在namespace的mount point。
###uts namespace
UTS("UNIX Time-sharing System") namespace允许每个container拥有独立的hostname和domain name, 使其在网络上可以被视作一个独立的节点而非Host上的一个进程。
###user namespace
每个container可以有不同的 user 和 group id, 也就是说可以在container内部用container内部的用户执行程序而非Host上的用户。
Control groups主要用来隔离各个容器和宿主主机的资源利用。

8
basic_concept/README.md Normal file
View File

@@ -0,0 +1,8 @@
# 基本概念
Docker 包括三个基本概念
* 镜像Image
* 容器Container
* 仓库Repository
理解了这三个概念,就理解了 Docker 的整个生命周期。

View File

@@ -0,0 +1,13 @@
## Docker 容器
镜像Image和容器Container的关系就像是面向对象程序设计中的`类``实例`一样,镜像是静态的定义,容器是镜像运行时的实体。容器可以被创建、启动、停止、删除、暂停等。
容器的实质是进程,但与直接在宿主执行的进程不同,容器进程运行于属于自己的独立的 [命名空间](https://en.wikipedia.org/wiki/Linux_namespaces)。因此容器可以拥有自己的 `root` 文件系统、自己的网络配置、自己的进程空间,甚至自己的用户 ID 空间。容器内的进程是运行在一个隔离的环境里,使用起来,就好像是在一个独立于宿主的系统下操作一样。这种特性使得容器封装的应用比直接在宿主运行更加安全。也因为这种隔离的特性,很多人初学 Docker 时常常会把容器和虚拟机搞混。
前面讲过镜像使用的是分层存储,容器也是如此。每一个容器运行时,是以镜像为基础层,在其上创建一个当前容器的存储层,我们可以称这个为容器运行时读写而准备的存储层为**容器存储层**。
容器存储层的生存周期和容器一样,容器消亡时,容器存储层也随之消亡。因此,任何保存于容器存储层的信息都会随容器删除而丢失。
按照 Docker 最佳实践的要求,容器不应该向其存储层内写入任何数据,容器存储层要保持无状态化。所有的文件写入操作,都应该使用 [数据卷Volume](https://docs.docker.com/engine/tutorials/dockervolumes/)、或者绑定宿主目录,在这些位置的读写会跳过容器存储层,直接对宿主(或网络存储)发生读写,其性能和稳定性更高。
数据卷的生存周期独立于容器,容器消亡,数据卷不会消亡。因此,使用数据卷后,容器可以随意删除、重新 `run`,数据却不会丢失。

15
basic_concept/image.md Normal file
View File

@@ -0,0 +1,15 @@
## Docker 镜像
我们都知道,操作系统分为内核和用户空间。对于 Linux 而言,内核启动后,会挂载 `root` 文件系统为其提供用户空间支持。而 Docker 镜像Image就相当于是一个 `root` 文件系统。比如官方镜像 `ubuntu:14.04` 就包含了完整的一套 Ubuntu 14.04 最小系统的 `root` 文件系统。
Docker 镜像是一个特殊的文件系统,除了提供容器运行时所需的程序、库、资源、配置等文件外,还包含了一些为运行时准备的一些配置参数(如匿名卷、环境变量、用户等)。镜像不包含任何动态数据,其内容在构建之后也不会被改变。
### 分层存储
因为镜像包含操作系统完整的 `root` 文件系统,其体积往往是庞大的,因此在 Docker 设计时,就充分利用 [Union FS](https://en.wikipedia.org/wiki/Union_mount) 的技术,将其设计为分层存储的架构。所以严格来说,镜像并非是像一个 ISO 那样的打包文件,镜像只是一个虚拟的概念,其实际体现并非由一个文件组成,而是由一组文件系统组成,或者说,由多层文件系统联合组成。
镜像构建时,会一层层构建,前一层是后一层的基础。每一层构建完就不会再发生改变,后一层上的任何改变只发生在自己这一层。比如,删除前一层文件的操作,实际不是真的删除前一层的文件,而是仅在当前层标记为该文件已删除。在最终容器运行的时候,虽然不会看到这个文件,但是实际上该文件会一直跟随镜像。因此,在构建镜像的时候,需要额外小心,每一层尽量只包含该层需要添加的东西,任何额外的东西应该在该层构建结束前清理掉。
分层存储的特征还使得镜像的复用、定制变的更为容易。甚至可以用之前构建好的镜像作为基础层,然后进一步添加新的层,以定制自己所需的内容,构建新的镜像。
关于镜像构建,将会在后续相关章节中做进一步的讲解。

View File

@@ -0,0 +1,29 @@
## Docker Registry
镜像构建完成后,可以很容易的在当前宿主上运行,但是,如果需要在其它服务器上使用这个镜像,我们就需要一个集中的存储、分发镜像的服务,[Docker Registry](https://docs.docker.com/registry/) 就是这样的服务。
一个 **Docker Registry** 中可以包含多个**仓库**Repository每个仓库可以包含多个**标签**Tag每个标签对应一个镜像。
一般而言,一个仓库包含的是同一个软件的不同版本的镜像,而标签则用于对应于软件的的不同版本。我们可以通过 `<仓库名>:<标签>` 的格式来指定具体是哪个版本的镜像。如果不给出标签,将以 `latest` 作为默认标签。
以 [Ubuntu 镜像](https://hub.docker.com/_/ubuntu/) 为例,`ubuntu` 是仓库的名字,其内包含有不同的版本标签,如,`14.04`, `16.04`。我们可以通过 `ubuntu:14.04`,或者 `ubuntu:16.04` 来具体指定所需哪个版本的镜像。如果忽略了标签,比如 `ubuntu`,那将视为 `ubuntu:latest`
仓库名经常以 *两段式路径* 形式出现,比如 `jwilder/nginx-proxy`,前者往往意味着 Docker Registry 多用户环境下的用户名,后者则往往是对应的软件名。但这并非绝对,取决于所使用的具体 Docker Registry 的软件或服务。
### Docker Registry 公开服务
Docker Registry 公开服务是开放给用户使用、允许用户管理镜像的 Registry 服务。一般这类公开服务允许用户免费上传、下载公开的镜像,并可能提供收费服务供用户管理私有镜像。
最常使用的 Registry 公开服务是官方的 [Docker Hub](https://hub.docker.com/),这也是默认的 Registry并拥有大量的高质量的官方镜像。除此以外还有 [CoreOS](https://coreos.com/) 的 [Quay.io](https://quay.io/repository/)CoreOS 相关的镜像存储在这里Google 的 [Google Container Registry](https://cloud.google.com/container-registry/)[Kubernetes](http://kubernetes.io/) 的镜像使用的就是这个服务。
由于某些原因,在国内访问这些服务可能会比较慢。国内的一些云服务商提供了针对 Docker Hub 的镜像服务Registry Mirror这些镜像服务被称为**加速器**。常见的有 [阿里云加速器](https://cr.console.aliyun.com/#/accelerator)、[DaoCloud 加速器](https://www.daocloud.io/mirror#accelerator-doc)、[灵雀云加速器](http://docs.alauda.cn/feature/accelerator.html)等。使用加速器会直接从国内的地址下载 Docker Hub 的镜像,比直接从官方网站下载速度会提高很多。在后面的章节中会有进一步如何配置加速器的讲解。
国内也有一些云服务商提供类似于 Docker Hub 的公开服务。比如 [时速云镜像仓库](https://hub.tenxcloud.com/)、[网易云镜像服务](https://c.163.com/hub#/m/library/)、[DaoCloud 镜像市场](https://hub.daocloud.io/)、[阿里云镜像库](https://cr.console.aliyun.com)等。
### 私有 Docker Registry
除了使用公开服务外,用户还可以在本地搭建私有 Docker Registry。Docker 官方提供了 [Docker Registry 镜像](https://hub.docker.com/_/registry/),可以直接使用做为私有 Registry 服务。在后续的相关章节中,会有进一步的搭建私有 Registry 服务的讲解。
开源的 Docker Registry 镜像只提供了 [Docker Registry API](https://docs.docker.com/registry/spec/api/) 的服务端实现,足以支持 `docker` 命令,不影响使用。但不包含图形界面,以及镜像维护、用户管理、访问控制等高级功能。在官方的商业化版本 [Docker Trusted Registry](https://docs.docker.com/datacenter/dtr/2.0/) 中,提供了这些高级功能。
除了官方的 Docker Registry 外,还有第三方软件实现了 Docker Registry API甚至提供了用户界面以及一些高级功能。比如[VMWare Harbor](http://vmware.github.io/harbor/index_cn.html) 和 [Sonatype Nexus](https://www.sonatype.com/docker)。

24
book.json Normal file
View File

@@ -0,0 +1,24 @@
{
"title": "Docker -- 从入门到实践",
"author": "yeasy",
"plugins": [
"image-captions",
"github-buttons"
],
"pluginsConfig": {
"image-captions": {
"attributes": {
"width": "600"
},
"caption": "图 _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_ - _CAPTION_"
},
"github-buttons": {
"repo": "yeasy/docker_practice",
"types": [
"star",
"watch"
],
"size": "small"
}
}
}

2
cases/README.md Normal file
View File

@@ -0,0 +1,2 @@
#实战案例
介绍一些典型的应用场景和案例。

View File

@@ -1,7 +1,7 @@
##多台物理主机之间的容器互联(暴露容器到真实网络中)
docker 默认的桥接网卡是docker0。它只会在本机桥接所有的容器网卡举例来说容器的虚拟网卡在主机上看一般叫做veth*** 而docker只是把所有这些网卡桥接在一起如下
## 多台物理主机之间的容器互联(暴露容器到真实网络中)
Docker 默认的桥接网卡是 docker0。它只会在本机桥接所有的容器网卡举例来说容器的虚拟网卡在主机上看一般叫做 veth*** 而 Docker 只是把所有这些网卡桥接在一起,如下:
```
[root@opnvz ~]# brctl show
[root@opnvz ~]# brctl show
bridge name bridge id STP enabled interfaces
docker0 8000.56847afe9799 no veth0889
veth3c7b
@@ -10,29 +10,30 @@ docker0 8000.56847afe9799 no veth0889
在容器中看到的地址一般是像下面这样的地址:
```
root@ac6474aeb31d:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
11: eth0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 4a:7d:68:da:09:cf brd ff:ff:ff:ff:ff:ff
inet 172.17.0.3/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::487d:68ff:feda:9cf/64 scope link
inet6 fe80::487d:68ff:feda:9cf/64 scope link
valid_lft forever preferred_lft forever
```
这样就可以把这个网络看成是一个私有的网络通过nat 连接外网,如果要让外网连接到容器中,就需要做端口映射,即-p参数(更多原理参见本文第六小节)
如果在企业内部应用,或则做多个物理主机的集群,可能需要将多个物理主机的容器组到一个物理网络中来,那么就需要将这个网桥桥接到我们指定的网卡上。
这样就可以把这个网络看成是一个私有的网络,通过 nat 连接外网,如果要让外网连接到容器中,就需要做端口映射,即 -p 参数
###拓扑图
主机A和主机B的网卡一都连着物理交换机的同一个vlan 101,这样网桥一和网桥三就相当于在同一个物理网络中了而容器一、容器三、容器四也在同一物理网络中了他们之间可以相互通信而且可以跟同一vlan中的其他物理机器互联。
![物理拓扑图](../images/container_connect_topology.png)
如果在企业内部应用,或者做多个物理主机的集群,可能需要将多个物理主机的容器组到一个物理网络中来,那么就需要将这个网桥桥接到我们指定的网卡上。
###ubuntu示例
下面以ubuntu为例创建多个主机的容器联网:
创建自己的网桥,编辑/etc/network/interface文件
### 拓扑图
主机 A 和主机 B 的网卡一都连着物理交换机的同一个 vlan 101,这样网桥一和网桥三就相当于在同一个物理网络中了,而容器一、容器三、容器四也在同一物理网络中了,他们之间可以相互通信,而且可以跟同一 vlan 中的其他物理机器互联。
![物理拓扑图](../_images/container_connect_topology.png)
### ubuntu 示例
下面以 ubuntu 为例创建多个主机的容器联网:
创建自己的网桥,编辑 /etc/network/interface 文件
```
auto br0
iface br0 inet static
@@ -43,9 +44,9 @@ bridge_ports em1
bridge_stp off
dns-nameservers 8.8.8.8 192.168.6.1
```
docker的默认网桥绑定到这个新建的br0上面这样就将这台机器上容器绑定到em1这个网卡所对应的物理网络上了。
Docker 的默认网桥绑定到这个新建的 br0 上面,这样就将这台机器上容器绑定到 em1 这个网卡所对应的物理网络上了。
ubuntu修改/etc/default/docker文件 添加最后一行内容
ubuntu 修改 /etc/default/docker 文件添加最后一行内容
```
# Docker Upstart and SysVinit configuration file
@@ -63,15 +64,15 @@ ubuntu修改/etc/default/docker文件 添加最后一行内容
DOCKER_OPTS="-b=br0"
```
在启动docker的时候 使用-b参数 将容器绑定到物理网络上。重启docker服务后再进入容器可以看到它已经绑定到你的物理网络上了。
在启动 Docker 的时候 使用 -b 参数 将容器绑定到物理网络上。重启 Docker 服务后,再进入容器可以看到它已经绑定到你的物理网络上了。
```
root@ubuntudocker:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
58b043aa05eb desk_hz:v1 "/startup.sh" 5 days ago Up 2 seconds 5900/tcp, 6080/tcp, 22/tcp yanlx
58b043aa05eb desk_hz:v1 "/startup.sh" 5 days ago Up 2 seconds 5900/tcp, 6080/tcp, 22/tcp yanlx
root@ubuntudocker:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.7e6e617c8d53 no em1
vethe6e5
```
这样就直接把容器暴露到你的物理网络上了,多台物理主机的容器也可以相互联网了。需要注意的是,这样就需要自己来保证容器的网络安全了。
这样就直接把容器暴露到物理网络上了,多台物理主机的容器也可以相互联网了。需要注意的是,这样就需要自己来保证容器的网络安全了。

14
cases/environment.md Normal file
View File

@@ -0,0 +1,14 @@
## 标准化开发测试和生产环境
对于大部分企业来说,搭建 PaaS 既没有那个精力,也没那个必要,用 Docker 做个人的 sandbox 用处又小了点。
可以用 Docker 来标准化开发、测试、生产环境。
![企业应用结构](../_images/enterprise_usage.png)
Docker 占用资源小,在一台 E5 128 G 内存的服务器上部署 100 个容器都绰绰有余,可以单独抽一个容器或者直接在宿主物理主机上部署 samba利用 samba 的 home 分享方案将每个用户的 home 目录映射到开发中心和测试部门的 Windows 机器上。
针对某个项目组,由架构师搭建好一个标准的容器环境供项目组和测试部门使用,每个开发工程师可以拥有自己单独的容器,通过 `docker run -v` 将用户的 home 目录映射到容器中。需要提交测试时,只需要将代码移交给测试部门,然后分配一个容器使用 `-v` 加载测试部门的 home 目录启动即可。这样,在公司内部的开发、测试基本就统一了,不会出现开发部门提交的代码,测试部门部署不了的问题。
测试部门发布测试通过的报告后,架构师再一次检测容器环境,就可以直接交由部署工程师将代码和容器分别部署到生产环境中了。这种方式的部署横向性能的扩展性也极好。

66
cases/supervisor.md Normal file
View File

@@ -0,0 +1,66 @@
## 使用 Supervisor 来管理进程
Docker 容器在启动的时候开启单个进程,比如,一个 ssh 或者 apache 的 daemon 服务。但我们经常需要在一个机器上开启多个服务,这可以有很多方法,最简单的就是把多个启动命令放到一个启动脚本里面,启动的时候直接启动这个脚本,另外就是安装进程管理工具。
本小节将使用进程管理工具 supervisor 来管理容器中的多个进程。使用 Supervisor 可以更好的控制、管理、重启我们希望运行的进程。在这里我们演示一下如何同时使用 ssh 和 apache 服务。
### 配置
首先创建一个 Dockerfile内容和各部分的解释如下。
```
FROM ubuntu:13.04
MAINTAINER examples@docker.com
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
```
### 安装 ssh、apache 和 supervisor
```
RUN apt-get install -y --force-yes perl-base=5.14.2-6ubuntu2
RUN apt-get install -y apache2.2-common
RUN apt-get install -y openssh-server apache2 supervisor
RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/log/supervisor
```
这里安装 3 个软件,还创建了 2 个 ssh 和 supervisor 服务正常运行所需要的目录。
```
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
```
添加 supervisord 的配置文件,并复制配置文件到对应目录下面。
```
EXPOSE 22 80
CMD ["/usr/bin/supervisord"]
```
这里我们映射了 22 和 80 端口,使用 supervisord 的可执行路径启动服务。
### supervisor配置文件内容
```
[supervisord]
nodaemon=true
[program:sshd]
command=/usr/sbin/sshd -D
[program:apache2]
command=/bin/bash -c "source /etc/apache2/envvars && exec /usr/sbin/apache2 -DFOREGROUND"
```
配置文件包含目录和进程,第一段 supervsord 配置软件本身,使用 nodaemon 参数来运行。第二段包含要控制的 2 个服务。每一段包含一个服务的目录和启动这个服务的命令。
### 使用方法
创建镜像。
```
$ sudo docker build -t test/supervisord .
```
启动 supervisor 容器。
```
$ sudo docker run -p 22 -p 80 -t -i test/supervisord
2013-11-25 18:53:22,312 CRIT Supervisor running as root (no user in config file)
2013-11-25 18:53:22,312 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2013-11-25 18:53:22,342 INFO supervisord started with pid 1
2013-11-25 18:53:23,346 INFO spawned: 'sshd' with pid 6
2013-11-25 18:53:23,349 INFO spawned: 'apache2' with pid 7
```
使用 `docker run` 来启动我们创建的容器。使用多个 `-p` 来映射多个端口,这样我们就能同时访问 ssh 和 apache 服务了。
可以使用这个方法创建一个只有 ssh 服务的基础镜像,之后创建镜像可以使用这个镜像为基础来创建

Some files were not shown because too many files have changed in this diff Show More