Skip to content

fix(network): set portMappings and dns capabilities on default bridge - #5210

Open
AruneshDwivedi wants to merge 1 commit into
containerd:mainfrom
AruneshDwivedi:fix-bridge-port-mappings-capabilities
Open

AruneshDwivedi wants to merge 1 commit into
containerd:mainfrom
AruneshDwivedi:fix-bridge-port-mappings-capabilities

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

Problem

The default bridge network plugin generated by nerdctl was missing the capabilities object entirely. According to the CNI spec, the portmap plugin requires capabilities.portMappings=true to be declared in the parent network configuration for it to process port mapping requests at runtime.

Without these capabilities, nerdctl run -p NNNN:MMMM ... silently fails on all platforms -- no port is forwarded and no error is returned to the user. This is especially impactful on Windows where port mapping is the primary way to access container services from the host.

Issue #5157 reports this specifically for Windows Server with containerd 2.3.3 and nerdctl 2.3.4.

Fix

Add portMappings: true and dns: true to the default bridge plugin capabilities. These are standard CNI capabilities that the portmap and dns plugins declare support for. The fix mirrors what existing pre-created network configs already include (see the test template in netutil_test.go line 53-56).

[BUGFIX] Default bridge network now declares portMappings and dns capabilities

Fixes #5157

The default bridge plugin generated by nerdctl was missing the
capabilities object entirely. Without "portMappings": true and
"dns": true in the CNI conflist, the Windows CNI plugin ignores
runtime port mapping requests (e.g. nerdctl run -p 5093:5093).

Add these capabilities to the default bridge configuration so that
port forwarding works out of the box on all platforms including
Windows Server with WSL2.

Fixes containerd#5157

Signed-off-by: AruneshDwivedi <arunesh.devops@gmail.com>
@AkihiroSuda

Copy link
Copy Markdown
Member

Without these capabilities, nerdctl run -p NNNN:MMMM ... silently fails on all platforms -- no port is forwarded and no error is returned to the user.

It has been working fine, at least on the Linux platform, no?

@AkihiroSuda AkihiroSuda Sep 17, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is especially impactful on Windows where port mapping is the primary way to access container services from the host.

This *_unix.go file doesn't seem relevant to Windows?
How did you test your PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default generated nerdctl-nat.conflist does not set capabilities.portMappings=true to enable host:container port mappings

2 participants