Skip to content

fix: check either ip_tables or nf_tables - #577

Merged
vvoland merged 1 commit into
docker:masterfrom
Ankumeah:576-fix-ip_tables-check
Sep 4, 2026
Merged

fix: check either ip_tables or nf_tables#577
vvoland merged 1 commit into
docker:masterfrom
Ankumeah:576-fix-ip_tables-check

Conversation

@Ankumeah

@Ankumeah Ankumeah commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Some systems use nf_tables instead of ip_tables in which case ip_tables may not be loaded.
Only one of ip_tables or nf_tables is checked
based on the output of iptables --version

closes #576

  • What I did
    Made rootless-install.sh compatible with systems that use nf_tables instead of ip_tables

  • How I did it
    iptables --version is ran to check if host system is using ip_tables or nf_tables and only the used module is checked

  • How to verify it

    • Delete docker if it is installed
    • Install nf_tables
    • Unload ip_tables
    • Load nf_tables
    • Run rootless-install.sh
    • If you get no errors then the script is verified
  • Description for the changelog
    fixed rootless installation with nf_tables

  • A picture of a cute animal
    Say hi to Bagel (my friend's dog)!

Bagel

@vvoland vvoland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

Comment thread rootless-install.sh Outdated
# https://github.com/moby/moby/blob/master/contrib/dockerd-rootless-setuptool.sh
# uses the same logic
iptables_module="nf_tables"
if [ -z "$SKIP_IPTABLES" ] && command -v iptables >/dev/null 2>&1 && iptables --version | grep -q "legacy"; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should probably also include sbin too when executing iptables

Like the Moby script does: https://github.com/moby/moby/blob/e70ce7a35b94b0915dae5ba356a69d07ded2fd46/contrib/dockerd-rootless-setuptool.sh#L145-L154

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In that case we can make the existing code a bit cleaner while we are at it too by making a iptables_command variable just like moby

Comment thread rootless-install.sh Outdated
# modules, it just outputs what it was compiled for
# we do not check further to avoid complex logic
#
# https://github.com/moby/moby/blob/master/contrib/dockerd-rootless-setuptool.sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably good to include a digested permalink instead of floating master branch reference

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did not know what that was until just now. I guess we learn something new everyday

@vvoland vvoland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM thanks!

@vvoland

vvoland commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Oh one last thing - can you squash your commits into one?

Some systems use nf_tables instead of ip_tables in
which case ip_tables may not be loaded.
Only one of ip_tables or nf_tables is checked
based on the output of `iptables --version`

Signed-off-by: ankumeah <ankitku00ish@gmail.com>
@Ankumeah
Ankumeah force-pushed the 576-fix-ip_tables-check branch from 869bcc7 to 5d73bed Compare September 4, 2026 14:02
@Ankumeah

Ankumeah commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Oh one last thing - can you squash your commits into one?

Sure

@vvoland vvoland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks!

@vvoland
vvoland merged commit 4e16be8 into docker:master Sep 4, 2026
13 checks passed
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.

rootless-install.sh does not check for nf_tables

2 participants