docker run --rm --network
leaves behind iptables
rules when stopped
#11324
Labels
kind/bug
Categorizes issue or PR as related to a bug.
locked - please file new issue/PR
Assist humans wanting to comment on an old issue or PR with locked comments.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
When
docker run --rm
is used to start a container in a non-default network (using--network
) that is then stopped (and automatically removed),iptables
rules created specifically for this container are left behind. This is especially bad when ports are published/forwarded (not demonstrated below), which causes DNAT rules to be added. When these are left behind, the host port is then unusable for future containers because the original rule takes precedence.Steps to reproduce the issue:
Describe the results you received:
Rules related to
CNI-3b4afbc074bb2197d7afd469
remain after the original container has been stopped and removed, as seen in the last two invocations ofiptables -t nat -S
.Describe the results you expected:
The rules should only exist for the lifetime of the container. The NAT table should return to the original state after the container is stopped.
Additional information you deem important (e.g. issue happens only occasionally):
Does not happen without
--rm
or--network
, or at least not consistently.Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes. Latest Fedora release with latest package from its repository.
Additional environment details (AWS, VirtualBox, physical, etc.):
Virtual machine on VMware ESXi. OS image from https://download.fedoraproject.org/pub/fedora/linux/releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.raw.xz .
The text was updated successfully, but these errors were encountered: