如何修复容器的静态 IP?
首先我启动一个容器并检查它,它说
"NetworkSettings": {
"IPAddress": "XX.XX.206.98",
"IPPrefixLen": 27,
"Gateway": "XX.XX.206.105",
"Bridge": "public",
"PortMapping": null,
"Ports": {}
},
然后我停止它,然后重新启动,就像
"NetworkSettings": {
"IPAddress": "XX.XX.206.99",
"IPPrefixLen": 27,
"Gateway": "XX.XX.206.105",
"Bridge": "public",
"PortMapping": null,
"Ports": {}
},
如您所见,它发生了变化。我刚刚创建了一个名为 public 的网桥,并 -b=public
添加了启动 docker。如何为容器设置静态 IP?