Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
SeanTCoder
docker_practice
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
docker_practice
/
opensource
/
linuxkit.md
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
51 lines (30 loc) · 1.2 KB
master
Breadcrumbs
docker_practice
/
opensource
/
linuxkit.md
Copy path
Top
File metadata and controls
Code
Blame
51 lines (30 loc) · 1.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
$ 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 默认页面。
You can’t perform that action at this time.