Skip to content
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

dockerd compatibility problem with nftables #17766

Open
qiuzi opened this issue Feb 1, 2022 · 14 comments
Open

dockerd compatibility problem with nftables #17766

qiuzi opened this issue Feb 1, 2022 · 14 comments

Comments

@qiuzi
Copy link

qiuzi commented Feb 1, 2022

@G-M0N3Y-2503 @neheb
In the future, iptables will be replaced. Will dockerd be perfectly compatible with nftables?

@brada4
Copy link

brada4 commented Feb 8, 2022

What is the exact compatibility problem you are referring to in the title? Docker works on all major Linux distributions, all of them being NFT for few years now.

@qiuzi
Copy link
Author

qiuzi commented Feb 8, 2022

@brada4 should be transitioned to nftables use, iptables will slowly be phased out
the current startup script can remove iptables dependencies and reduce redundant components

@G-M0N3Y-2503
Copy link
Contributor

Thanks for the thought-provoking question, I'm moving house ATM so I haven't had much time to look into this.
I did find moby/moby#26824 that I am yet to read, but, it might provide some guidance on this question in the interim.

@brada4
Copy link

brada4 commented Feb 8, 2022

Docker supports iptables command line only. Enough is emulated via NFT iptables wrappers on any (?other?) system out there.
Thats is a question to Docker Inc. to support some novelty environment.

@G-M0N3Y-2503
Copy link
Contributor

It seems that docker still depends on iptables until something like moby/moby#26824 is done.
With the advent of #16818, I'm working on having docker use iptables-nft.

It does sound like a possible feature to remove any iptables dependencies and disable iptables in the docker config for a custom build, but that sounds like a separate issue to this one.

So from my perspective, this issue is a duplicate of #16818

@brada4
Copy link

brada4 commented Mar 17, 2022

@brada4 should be transitioned to nftables use, iptables will slowly be phased out the current startup script can remove iptables dependencies and reduce redundant components

In the official post iptables-nft is recommended as a compatibility option, on par with what official docker package repos do. (podman too, before you ask)

@qiuzi
Copy link
Author

qiuzi commented Mar 17, 2022

iptables-nft is not the best solution, nft has other new features

@G-M0N3Y-2503
Copy link
Contributor

In the official post iptables-nft is recommended as a compatibility option, on par with what official docker package repos do. (podman too, before you ask)

I'm not sure to what you are referring to, if you have links I'd appreciate them.
Because from what I can tell using iptables-nft is how current official packages are supporting netfilter.
see https://github.com/docker/docker-ce-packaging/blob/master/deb/common/control#L32

@acooler15
Copy link
Contributor

My Docker container has access to the local network but not the internet when use iptables-nft😢

@brada4
Copy link

brada4 commented Mar 18, 2022

There should be forward rule for each exposed port and one for all masquerade rule involving docker's internal bridge (in iptables-save)
Which way it does not work?

@champtar
Copy link
Member

With nftables you now have multiple tables, if a rule in fw4 table drop a packet,
the fact that it was accepted in the filter table (configured by iptables-nft) doesn't matter.
So you might need to add some allow rules in fw4 for docker to work.
can someone show the output of iptables-nft-save and nft list ruleset when running docker ?

@brada4
Copy link

brada4 commented Mar 18, 2022

centos8-tables.txt
centos8-nft.txt
"how it should look"

Yes, I flushed tables before restarting docker so that it shows only docker additions.

@champtar
Copy link
Member

@brada4 you just don't have any firewall configured on your CentOS8 box

@koolkhel
Copy link

koolkhel commented Mar 31, 2022

It's an issue for me as well. For docker-compose it's avoidable by manually creating bridges (in my example it's br-transmission) and doing

/usr/sbin/nft insert rule inet fw4 forward iifname "br-transmission" accept
/usr/sbin/nft insert rule inet fw4 forward iifname "br-lan" oifname "br-transmission" accept

After these two commands the containers have normal connectivity.

For docker build I'm using docker build --network=host and it works.

Yes, I'm using iptables-nft.

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

No branches or pull requests

6 participants