fix: cannot start container when IPv6 is disabled#4824
Open
shouhei wants to merge 1 commit intocontainerd:mainfrom
Open
fix: cannot start container when IPv6 is disabled#4824shouhei wants to merge 1 commit intocontainerd:mainfrom
shouhei wants to merge 1 commit intocontainerd:mainfrom
Conversation
…d systems Signed-off-by: Shouhei <shouhei.yamaguchi.be@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On systems where IPv6 is disabled (e.g. kernel boot parameter
ipv6.disable=1), running a container with port mapping fails with the following error:Root Cause
When allocating host ports, nerdctl unconditionally reads
/proc/net/tcp6and/proc/net/udp6to check for ports already in use. On IPv6-disabled systems, the kernel does not create these files, causing the port allocation to fail entirely.Fix
Treat
ErrNotExistfor/proc/net/tcp6and/proc/net/udp6as a non-error, returningnil(no IPv6 ports in use) instead of propagating the error.Result
After this fix, containers with port mapping (
-p) start successfully on IPv6-disabled systems.Testing
No unit test is added at this time, as
netTCP6StatsandnetUDP6Statsare defined asconst, making it difficult to inject alternative paths. If the maintainers prefer, these could be changed tovarto allow unit testing with a mock path.