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

[docker-in-docker] Not working on fedora kernel > 6.11.7-300.fc41.x86_64 #1235

Open
michalholis opened this issue Jan 3, 2025 · 6 comments
Assignees

Comments

@michalholis
Copy link

michalholis commented Jan 3, 2025

Feature https://github.com/devcontainers/features/tree/main/src/docker-in-docker for some reason doesn't work for us on Fedora 41 on kernel versions 6.11.7-300.fc41.x86_64. Kernel 6.11.7-300.fc41.x86_64 is the last one working without issues. On any newer kernel any docker command returns Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?.

Communication fails on any docker command and fails even on clean Fedora installation.

@Kaniska244 Kaniska244 self-assigned this Jan 13, 2025
@Kaniska244
Copy link

Hello @michalholis ,

Thank you for reporting the issue. I will check and get back on this.

With Regards,
Kaniska

@David-337
Copy link

Same issue here on Bluefin which is a distro based on Fedora

@HerrNaN
Copy link

HerrNaN commented Jan 24, 2025

Any updates on this?

@matus-sabo
Copy link

matus-sabo commented Feb 9, 2025

Some information and workaround (debian bookworm docker image)

sudo dockerd --debug

failed to start daemon: Error initializing network controller: 
error obtaining controller instance: failed to register "bridge" driver: 
failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: 
modprobe: FATAL: Module ip_tables not found in directory /lib/modules/6.12.11-200.fc41.x86_64
iptables v1.8.9 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
 (exit status 3)

Problem is that your host system do not load ip_tables kernel module lsmod | grep ip_tables should be empty

To load ip_tables kernel module you can run

sudo modprobe ip_tables

Pernament solution that survive reboots ( I am using Fedora silverblue )
/etc/modules-load.d/ip_tables.conf

ip_tables

docker info finally working 🚀

@spietras
Copy link

spietras commented Feb 20, 2025

I suspect this might happen if you don't have the ip_tables module loaded, which is required for iptables-legacy to work. Most likely you only have nf_tables module, which should be fine, if you can use iptables-nft.

If I do this inside the container (using ubuntu as base):

sudo update-alternatives --set iptables /usr/sbin/iptables-nft
sudo dockerd

then it doesn't fail.

However, I can see that docker-in-docker install script first installs iptables package (which for me always provides both iptables-legacy and iptables-nft) and then links iptables command to iptables-legacy if iptables-legacy is present. Which results in iptables-legacy always being used and always failing if you don't have ip_tables module.

# Swap to legacy iptables for compatibility
if type iptables-legacy > /dev/null 2>&1; then
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
fi

I am not fully sure about that, but maybe the installation script should not link to iptables-legacy, but instead keep iptables linked to whatever it is linked by default (which is iptables-nft is my case).

@matus-sabo
Copy link

@spietras Yes you are right load ip_tables kernel module resolve this issue 👍

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