Hi,
Apologize, if I’m not sufficient explicit, it’s my first post about docker, be clever, I’m discovering docker.
The trouble I have, is that docker doesn’t create needed chains in iptables when starting a container on my Ubuntu system 24.04.3.
Before troubles begun, I used docker-compose and it was ok, DOCKER’S chains had been created in iptables.
I also used ufw, wich works fine for me.
Then I decide to reinstall all for best practice, and I had read :
Official docker’s documentation said :
Docker and ufw use iptables in ways that make them incompatible with each other.
I disabled ufw
Official docker’s documentation said :
Docker is only compatible with
iptables-nft(…) Firewall rules created withnftare not supported (…) Make sure that any firewall rulesets you use are created withiptables(..), and that you add them to theDOCKER-USERchain
ls -al /usr/sbin/iptables
lrwxrwxrwx 1 root root 26 févr. 2 2020 /usr/sbin/iptables -> /etc/alternatives/iptables
ls -l /etc/alternatives/iptables
lrwxrwxrwx 1 root root 22 août 20 2022 /etc/alternatives/iptables -> /usr/sbin/iptables-nft
iptables on my system is iptables-nft
Official docker’s documentation said :
Before you can install Docker Engine, you need to uninstall any conflicting packages, as mentioned :
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
Old packages removed
Official docker’s documentation said :
Docker Engine comes bundled with Docker Desktop for Linux. This is the easiest and quickest way to get started.
Docker Desktop Installed
Well. At this moment I have a fresh install.
I launch a new container and restore bdd, it’s running well.
But docker had not create all the docker’s chain rules in iptables refering to the command :
$ sudo iptables –F
$ sudo iptables -X
$ sudo 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
$ docker compose up -d
$ sudo 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
Here, No DOCKER’s chains in iptables !!!
What i have verified
:
- There isn’t any /etc/docker/daemon.json file.
- if I write one with this content, it’s the same thing :
{
"log-level": "error",
"iptables": true,
"ip6tables": false,
"ip-forward": true,
"ip-masq": true,
"ipv6": false
}
Here where i am. I’m a little bit confused, it was working before I reinstall all. The main difference, is that Docker Engine is now installed with Docker Desktop as recommanded in the Official docker’s documentation.
Should I have to reinstall all without Docker Desktop ?
Any help would be welcome. Thanks.
Regards.