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 }}
unsignedcpp
docker_practice
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
docker_practice
/
security
/
kernel_ns.md
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
16 lines (9 loc) · 1.4 KB
master
Breadcrumbs
docker_practice
/
security
/
kernel_ns.md
Copy path
Top
File metadata and controls
Code
Blame
16 lines (9 loc) · 1.4 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
#
内核命名空间
Docker
容器和
LXC
容器很相似
,
所提供的安全特性也差不多
。
当用
`docker run`
启动一个容器时
,
在后台
Docker
为容器创建了一个独立的命名空间和控制组集合
。
命名空间提供了最基础也是最直接的隔离
,
在容器中运行的进程不会被运行在主机上的进程和其它容器发现和作用
。
每个容器都有自己独有的网络栈
,
意味着它们不能访问其他容器的
sockets
或接口
。
不过
,
如果主机系统上做了相应的设置
,
容器可以像跟主机交互一样的和其他容器交互
。
当指定公共端口或使用
links
来连接
2
个容器时
,
容器就可以相互通信了
(
可以根据配置来限制通信的策略
)。
从网络架构的角度来看
,
所有的容器通过本地主机的网桥接口相互通信
,
就像物理机器通过物理交换机通信一样
。
那么
,
内核中实现命名空间和私有网络的代码是否足够成熟
?
内核命名空间从
2.6
.15
版本
(
2008
年
7
月发布
)
之后被引入
,
数年间
,
这些机制的可靠性在诸多大型生产系统中被实践验证
。
实际上
,
命名空间的想法和设计提出的时间要更早
,
最初是为了在内核中引入一种机制来实现
[
OpenVZ
](
https
:
//en.wikipedia.org/wiki/OpenVZ) 的特性。
而
OpenVZ
项目早在
2005
年就发布了
,
其设计和实现都已经十分成熟
。
You can’t perform that action at this time.