robbertkl / docker-ipv6nat

Extend Docker with IPv6 NAT, similar to IPv4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Removal of ip6table Rules Upon Stopping Container

abhinava opened this issue · comments

Hi there! Thanks for this really awesome utility! I've been using this for few days now and seems to work really well!

One feature enhancement if you can consider, is to remove all the ip6table rules when the container is stopped. I tried to manually delete the rules myself externally after stopping the container but this seems a bit complex.

Perhaps you know the different chains and rules that are being created when the container is started - Perhaps you can have a script that can be run which can clean-up/remove these rules?

Hi @abhinava, docker-ipv6nat has a --cleanup flag for removing all of the created IPv6 rules on shutdown of docker-ipv6nat itself. Individual container rules are automatically added (and removed!) when containers get started/stopped (or connected/disconnected from a Docker network).

Thanks! I'm using the container version (link) not the native binary as a Linux systemd service.

Is there a particular way to stop the container? If I try the "docker container stop..", the rules don't seem to be getting cleaned up. Perhaps Am I missing something?

You can add --retry --cleanup to the end of the command you use to start the ipv6nat container.

(--retry is the default, as can be seen in https://github.com/robbertkl/docker-ipv6nat/blob/master/Dockerfile)

Awesome! Thanks for this tip!

Perhaps you could add this note to the README?

Great suggestion, I've clarified it a bit in the README, see e60fa0f.