Skip to content

Engine networking updates for moby 29.0 #23215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

robmry
Copy link
Contributor

@robmry robmry commented Aug 7, 2025

Description

  • Some clarifications and a hopefully-gentler intro for the networking overview page
  • Bridge driver - add some more intro words
  • With nftables on the way - refer to "firewall" instead of "iptables" in the top-level description in packet-filtering-firewalls.md, move out the iptables specifics, and port-publishing (which applies to both iptables and nftables).
  • Add firewall-nftables.md describing migration to experimental --firewall-backend=nftables.

Reviews

Copy link

netlify bot commented Aug 7, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 4309ba9
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6895ddc5018fd100080adf1f
😎 Deploy Preview https://deploy-preview-23215--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added area/engine Issue affects Docker engine/daemon area/networking Relates to anything around networking labels Aug 7, 2025
@robmry robmry changed the title Engine networking overview updates Engine networking updates for moby 29.0 Aug 7, 2025
@robmry robmry force-pushed the moby_networking_tweaks branch 2 times, most recently from fc431e9 to fbdde7d Compare August 7, 2025 18:46
robmry added 4 commits August 8, 2025 12:13
With nftables on the way - refer to "firewall" instead of
"iptables" in the top-level description of packet-filtering-firewalls,
move out the iptables specifics, and port-publishing (which
applies to both iptables and nftables).

Signed-off-by: Rob Murray <[email protected]>
Adds engine/network/firewall-nftables.md

Signed-off-by: Rob Murray <[email protected]>
@robmry robmry force-pushed the moby_networking_tweaks branch from fbdde7d to 4309ba9 Compare August 8, 2025 11:21

```console
$ docker network create -d bridge my-net
$ docker run --network=my-net -itd --name=container3 busybox
$ docker run --network=my-net -it --name=container3 busybox
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--name=container3 was already there but it seems unnecessary to me as it doesn't relate to anything explained above.

Comment on lines 27 to 29
In terms of networking, a bridge network is a Link Layer device
which forwards traffic between network segments. A bridge can be a hardware
device or a software device running within a host machine's kernel.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to keep this paragraph? Users don't need to know how network bridging works in general to use the bridge network driver. And saying 'a bridge can be a hardware device' looks confusing because the Engine doesn't support that.

Comment on lines +232 to +233
$ docker run -d --name redis example/redis --bind 127.0.0.1
$ docker run --rm -it --network container:redis example/redis-cli -h 127.0.0.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example can't run because it references the non-existent example/redis image. It's probably worth replacing it with the official redis image.

Suggested change
$ docker run -d --name redis example/redis --bind 127.0.0.1
$ docker run --rm -it --network container:redis example/redis-cli -h 127.0.0.1
$ docker run -d --name redis redis --bind 127.0.0.1
$ docker run --rm -it --network container:redis redis-cli -h 127.0.0.1

Comment on lines +227 to +229
The following example runs a Redis container, with Redis binding to
`localhost`, then running the `redis-cli` command and connecting to the Redis
server over the `localhost` interface.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be improved. Containers have no 'localhost' interface, so this is technically wrong, and 'localhost' isn't even specified in the command. So, either replace 'localhost' with 'loopback', or maybe just use '127.0.0.1' instead?

Suggested change
The following example runs a Redis container, with Redis binding to
`localhost`, then running the `redis-cli` command and connecting to the Redis
server over the `localhost` interface.
The following example runs a Redis container, with Redis binding to
127.0.0.1, then running the `redis-cli` command and connecting to the Redis
server over 127.0.0.1.

### Docker and iptables chains

To support bridge and overlay networks, Docker creates the following custom
`iptables` chains:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`iptables` chains:
`iptables` chains in the `filter` table:

However, this is not recommended for most users as it will likely break
container networking.

### Docker and iptables chains
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth mentioning the raw-PREROUTING chain somewhere (but this may not be the most appropriate section though)?

Comment on lines +47 to +48
> publish flag, only the Docker host and its containers can access the
> published container port.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the Docker host can access ports published on 127.0.0.1.

Suggested change
> publish flag, only the Docker host and its containers can access the
> published container port.
> publish flag, only the Docker host.

Comment on lines +142 to +143
In `nat` mode, when a port is published to a specific host address, that
port is only accessible via the host interface with that address. So,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not true. If a Docker host has two NICs with addresses 192.168.100.10/24 and 10.0.0.10/24, IP forwarding is enabled, and a port published on 192.168.100.10, another host in the 10.0.0.0/24 subnet can access that port if its routing table has an entry for routing 192.168.100.10 via 10.0.0.10.

Comment on lines +144 to +145
for example, publishing a port to an address on the loopback interface
means remote hosts cannot access it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this part is true as loopback addresses aren't intended to be routed.

Comment on lines +290 to +293
This changes the default binding address to `127.0.0.1` for published container
ports on the default bridge network.
Restart the daemon for this change to take effect.
Alternatively, you can use the `dockerd --ip` flag when starting the daemon.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this formatted as a single line (see here), so no need to put extra new lines in the md file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/engine Issue affects Docker engine/daemon area/networking Relates to anything around networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants