-
Notifications
You must be signed in to change notification settings - Fork 31
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
automated rules removed and not properly added back on docker service restart #47
Comments
Hi, thanks for the report. I see what's going on here. https://github.com/shinebayar-g/ufw-docker-automated/blob/main/main.go#L64 this code is syncing existing containers, but only executed on the startup. I should call the function on reconnect as well.
|
Ah, I see that now, great. Seems like an easy fix. |
Yep, will upgrade dependencies and cleanup some things and cut a new release this weekend. |
Cool deal. One minor nit: would be good to have instructions for building from source in the README. Wasn't hard, but not being familiar with building Go code, it took a bit of Googling. |
That's fair. Do you prefer to build yourself instead of downloading from releases page? |
Yeah, given the level of integration into the system (running as |
Sorry if I'm joining in here. I also have problems with Ubuntu 22.04 since short. Unfortunately, the workaround does nothing for me. No more rules are added.
only shows
and
shows only this, even on a container restart
|
Hey guys, sorry that I didn't fix this sooner. I just tagged a new release v0.11.0 Tested the behavior with |
No problem, thank you for the update! I’ll give it a try shortly and let you know if any problems. Unrelated, I was sometimes seeing an issue with duplicate rules — i.e. rules would sometimes not be deleted when the container was stopped and restarted and you’d end up with two (or more) of the same rule after awhile. Might have just been an issue with named rules (where some title was set after the rule port number)…I’ll see if I can reproduce it and post an issue if so. |
Sounds good. In general |
Running into an issue on an Ubuntu 22.04 x64 host (using the latest
ufw-docker-automated
, built from source onmaster
) where the ufw container rules established is deleted and not properly recreated on aservice docker restart
/systemctl restart docker
command.E.g. - prior to
docker service restart
:After
sudo service docker restart
:Running
service ufw-docker-automated restart
will successfully re-create the custom rules.It seems that
ufw-docker-automated
has code to detect a disconnect from tcp. Here's what I see in/var/log/syslog
after thedocker
service restarts:However, inbound rules are not correctly readded post-service restart. Once I manually restart the
ufw-docker-automated
service/var/log/syslog
shows:Not familiar with Go code, but it seems like the service tries to reconnect to the Docker UNIX domain socket (e.g.
/var/run/docker.sock
) but perhaps binds to an old or inactive version of it?Anyhow, I "fixed" this issue by adding
PartOf=docker.service
to mysystemd
ufw-docker-automated.service
file, as so:A better fix might be more robust reconnection detection in the code, perhaps.
The text was updated successfully, but these errors were encountered: