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
/
advanced_network
/
quick_guide.md
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
26 lines (19 loc) · 1.33 KB
master
Breadcrumbs
docker_practice
/
advanced_network
/
quick_guide.md
Copy path
Top
File metadata and controls
Code
Blame
26 lines (19 loc) · 1.33 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
#
快速配置指南
下面是一个跟
Docker
网络相关的命令列表
。
其中有些命令选项只有在
Docker
服务启动的时候才能配置
,
而且不能马上生效
。
*
`-b BRIDGE`
或
`--bridge=BRIDGE`
指定容器挂载的网桥
*
`--bip=CIDR`
定制
docker0
的掩码
*
`-H SOCKET...`
或
`--host=SOCKET...`
Docker
服务端接收命令的通道
*
`--icc=true|false`
是否支持容器之间进行通信
*
`--ip-forward=true|false`
请看下文容器之间的通信
*
`--iptables=true|false`
是否允许
Docker
添加
iptables
规则
*
`--mtu=BYTES`
容器网络中的
MTU
下面2个命令选项既可以在启动服务时指定
,
也可以在启动容器时指定
。
在
Docker
服务启动的时候指定则会成为默认值
,
后面执行
`docker run`
时可以覆盖设置的默认值
。
*
`--dns=IP_ADDRESS...`
使用指定的DNS服务器
*
`--dns-search=DOMAIN...`
指定DNS搜索域
最后这些选项只有在
`docker run`
执行时使用
,
因为它是针对容器的特性内容
。
*
`-h HOSTNAME`
或
`--hostname=HOSTNAME`
配置容器主机名
*
`--link=CONTAINER_NAME:ALIAS`
添加到另一个容器的连接
*
`--net=bridge|none|container:NAME_or_ID|host`
配置容器的桥接模式
*
`-p SPEC`
或
`--publish=SPEC`
映射容器端口到宿主主机
*
`-P or --publish-all=true|false`
映射容器所有端口到宿主主机
You can’t perform that action at this time.