Repository navigation
Description
Description
/proc/net/ip_tables_names is empty until the tables are explicitly queried
Steps to reproduce the issue:
$ cat /proc/net/ip_tables_names
mangle
nat
filter
$ docker run --cap-add NET_ADMIN -it --rm ubuntu /bin/bash
root@5da0f128f3aa:/# apt-get update && apt-get install -y iptables kmod
[...]
root@5da0f128f3aa:/# lsmod > lsmod.before
root@5da0f128f3aa:/# cat /proc/net/ip_tables_names
root@5da0f128f3aa:/# iptables -t filter -vnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
root@5da0f128f3aa:/# cat /proc/net/ip_tables_names
filter
root@5da0f128f3aa:/# lsmod > lsmod.after
root@5da0f128f3aa:/# diff -Nru lsmod.before lsmod.after
root@5da0f128f3aa:/#
Describe the results you received:
In a container, /proc/net/ip_tables_names is empty, until I query iptables -t {filter,nat,mangle} -L, then it becomes populated with the tables I queried. This happens with any new containers I create. ip_tables_names is populated correctly on the host. It doesn't look like this is due to loading any modules.
Describe the results you expected:
/proc/net/ip_tables_names should be populated with whatever its contents are on the host, at container startup.
Additional information you deem important (e.g. issue happens only occasionally):
Happens reliably for me.
This issue is pretty obscure, but it turns out that early logic in OpenWRT (at least 15.05.1, latest stable) keys on ip_tables_names to do firewall setup, so containers don't come up correctly. I'm not aware of any published images with this version, I was creating one for myself.
I was able to work around the issue by putting an early hook in my image to query iptables.
Output of docker version:
Client:
Version: 17.03.1-ce
API version: 1.27
Go version: go1.8.3
Git commit: c6d412e
Built: Thu Jul 27 00:28:39 2017
OS/Arch: linux/amd64
Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.8.3
Git commit: c6d412e
Built: Thu Jul 27 00:28:39 2017
OS/Arch: linux/amd64
Experimental: false
Output of docker info:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 95
Server Version: 17.03.1-ce
Storage Driver: zfs
Zpool: data
Zpool Health: ONLINE
Parent Dataset: data/root
Space Used By Parent: 4386445440
Space Available: 8289936791040
Parent Quota: no
Compression: lz4
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 595e75c212d19a81d2b808a518fe1afc1391dad5 (expected: 4ab9917febca54791c5f071a9d1f404867857fcc)
runc version: 54296cf (expected: 54296cf40ad8143b62dbcaa1d90e520a2136ddfe)
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
seccomp
Profile: default
Kernel Version: 4.12.3
Operating System: Gentoo/Linux
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.42 GiB
Name: server
ID: UGPX:QSY6:BCL6:WOGC:2XWS:US5V:Q7LV:VAJY:7SB4:5P7L:3A7H:HKFP
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.):
This is my own baremetal box, running Gentoo with a custom kernel config. It's entirely possible my config is weird and this doesn't reproduce on other environments, but I couldn't guess how.
Activity
sbrudenell commentedon Aug 4, 2017
Including my kernel config.
config.txt
Today I noticed another one of my containers (linuxserver/letsencrypt, which includes fail2ban) is also getting confused over the fact that the 'filter' table doesn't exist. This suggests authors aren't trying to work around this issue, and it only applies to my setup somehow ...
thaJeztah commentedon Sep 18, 2023
Let me close this ticket for now, as it looks like it went stale.