Add linuxkit #287

pull/290/head
khs1994 2017-12-08 23:01:04 +08:00
parent 3b508242ba
commit 7b93ed069f
4 changed files with 59 additions and 1 deletions

View File

@ -9,6 +9,8 @@
* 增加 Docker 中文资源链接
* 增加介绍基于 Docker 的 CI/CD 工具 `Drone`
* 增加 `docker secret` 相关内容
* 增加 `docker config` 相关内容
* 增加 `LinuxKit` 相关内容
* 更新 `CoreOS` 章节
* 更新 `etcd` 章节,基于 3.x 版本

View File

@ -138,6 +138,8 @@
* [本章小结](cases/os/summary.md)
* [实战案例-CI/CD](cases/ci/README.md)
* [Drone](cases/ci/drone.md)
* [Docker 开源项目](opensource/README.md)
* [LinuxKit](opensource/linuxkit.md)
* [附录](appendix/README.md)
* [附录一:常见问题总结](appendix/faq/README.md)
* [附录二:热门镜像介绍](appendix/repo/README.md)
@ -150,6 +152,6 @@
* [WordPress](appendix/repo/wordpress.md)
* [Node.js](appendix/repo/nodejs.md)
* [附录三Docker 命令查询](appendix/command/README.md)
* [附录四Dockerfile 最佳实践](appendix/best_practices.md))
* [附录四Dockerfile 最佳实践](appendix/best_practices.md)
* [附录五:资源链接](appendix/resources/README.md)
* [附录六Docker 中文资源](appendix/resources/cn.md)

3
opensource/README.md Normal file
View File

@ -0,0 +1,3 @@
# Docker 开源项目
本章介绍 Docker 开源的项目。随着 Docker 功能的越来越多Docker 也加快了开源的步伐Docker 未来会将引擎拆分为更多开放组件,对用于组装 Docker 产品的各种新型工具与组件进行开源并供技术社区使用。

51
opensource/linuxkit.md Normal file
View File

@ -0,0 +1,51 @@
## LinuxKit
`LinuxKit` 这个工具可以将多个 Docker 镜像组成一个最小化、可自由定制的 Linux 系统,最后的生成的系统只有几十 M 大小,可以很方便的在云端进行部署。
下面我们在 macOS 上通过实例,来编译并运行一个全部由 Docker 镜像组成的包含 nginx 服务的 Linux 系统。
### 安装 Linuxkit
```bash
$ brew tap linuxkit/linuxkit
$ brew install --HEAD linuxkit
```
### 克隆源代码
```bash
$ git clone -b master --depth=1 https://github.com/linuxkit/linuxkit.git
$ cd linuxkit
```
### 编译 Linux 系统
LinuxKit 通过 `yaml` 文件配置。
我们来查看 `linuxkit.yml` 文件,了解各个字段的作用。
`kernel` 字段定义了内核版本。
`init` 字段中配置系统启动时的初始化顺序。
`onboot` 字段配置系统级的服务。
`services` 字段配置镜像启动后运行的服务。
`files` 字段配置制作镜像时打包入镜像中的文件。
```bash
$ linuxkit build linuxkit.yml
```
### 启动 Linux 系统
编译成功后,接下来启动这个 Linux 系统。
```bash
$ linuxkit run -publish 8080:80/tcp linuxkit
```
接下来在浏览器中打开 `127.0.0.1:8080` 即可看到 nginx 默认页面。