You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker 18.03无法在overlay网络指定静态IP 10.0.7.2创建容器咨询

Why Can't You Assign 10.0.7.2 to a Container in Docker 18.03's Overlay Network?

Let’s break down exactly what’s happening here and why your static IP assignment stopped working after the upgrade:

What’s Using 10.0.7.2?

Starting with Docker 17.06 (which includes the 18.03 version you’re using), when you create an overlay network like mynet, Docker automatically reserves two key IP addresses in your subnet:

  • 10.0.7.1: The network gateway (you already identified this)
  • 10.0.7.2: This IP is allocated to Docker’s internal network management endpoint for the overlay network. It’s used to handle cross-node container communication, service discovery, and underlying VXLAN traffic routing between Docker nodes. Even on a single-node setup, this reservation applies—think of it as a backend proxy IP Docker relies on to keep the overlay network stable and functional.

You can confirm this yourself by running:

docker network inspect mynet

Check the IPAM section in the output, and you’ll see 10.0.7.2 listed as a reserved IP or linked to an internal Docker network component.

Why Did This Start Happening After the Upgrade?

Docker 17.05 didn’t have this reservation policy for overlay networks. The change was introduced in later versions to support more robust swarm networking features: improved ingress routing, stable service VIPs, and more reliable cross-node network performance. By reserving x.x.x.2 for internal use, Docker eliminates conflicts between user-assigned container IPs and the critical network infrastructure that keeps overlay networks running smoothly.

How to Fix Your Static IP Issue?

You have two simple, reliable options:

  • Use an unreserved static IP: Pick any IP from your subnet that’s not 10.0.7.1 or 10.0.7.2 (e.g., 10.0.7.3, 10.0.7.4, etc.). All these addresses are available for container assignment.
  • Verify reserved IPs upfront: Before assigning static IPs, always run docker network inspect mynet to check the reserved range—this avoids future conflicts with Docker’s internal network components.

内容的提问来源于stack exchange,提问作者Nitish Mowall

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 06:51:16