惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 南桥一梦

Windows Hyper-v 开启嵌套虚拟化的方法 MySQL命令记录 Windows Server 2019 安装Windows Docker和.NET Framework 4.8镜像 MySQL优化 右键菜单怎样添加“在此处打开命令提示符”选项 MemSQL与MySQL不兼容问题总结 Ubuntu Server 18.04 修改网路配置 How to Install MemSQL Metro UI 菜单(Winform) Windows Server 2008 系统设置集合 Ubuntu 12.04和MySQL5.5安装 MySQL 参数设置 VS中如何自定义新建文件模板(添加自定义版权信息) Microsoft Windows Server 2008 R2 CHS 官方最新正版下载 在Hyper-V中安装和配置Ubuntu Server 11.04 10.10 解决WebClient或HttpWebRequest首次连接缓慢问题 Ubuntu MySQL Master-Master InnoDb Utf-8 配置文件 Ubuntu MySQL热备份安装 HOWTO:为 Hyper-V 配置外部网络
Windows Docker 固定容器IP地址 透明网络驱动程序
南桥一梦 · 2021-12-21 · via 博客园 - 南桥一梦

测试环境:

 Windows Server 2019数据中心版本

步骤一:

1. 获取当前所有的网卡

结果:
返回所有的网卡信息,选择你需要开发的网卡名称,注意这里的网卡不能是虚拟网卡,应该是未进行虚拟化的物理网卡。

2.创建Docker的透明网络驱动  

docker network create -d "transparent" --subnet 192.168.0.0/24 --gateway 192.168.0.1 -o com.docker.network.windowsshim.dnsservers="192.168.0.254" -o com.docker.network.windowsshim.interface="NIC2" my_transparent

意思就是通过NIC2创建一个透明网络,可进行物理交换机的访问。其中DNS的地址为192.168.0.254,网关地址为192.168.0.1,子网掩码:255.255.255.0

3.指定改网络运行容器

docker run  -v c:\app:c:\app -it -d --ip=192.168.0.92 --net=my_transparent --name=ibms ibms:v1.50

指定容器运行的IP地址为192.168.0.92,如果你需要动态分配IP就不指定ip参数。

4.查看运行结果

然后运行命令:

获得结果:

Windows IP Configuration

Host Name . . . . . . . . . . . . : bb304d962c2d
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter vEthernet (Ethernet):

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #4
Physical Address. . . . . . . . . : 00-15-5D-AF-F2-5A
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::2904:8bb9:e118:70a7%46(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.0.92(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 192.168.0.254
NetBIOS over Tcpip. . . . . . . . : Disabled

验证正确!