Is there a way to have a docker container restart every 10 minutes? I'm having issues with AdGuardHome. reddit / selfhosted ---------------------------------------------------------------------- askaway0002 · 2023-12-24 19:09 My AdGuardHome docker container has issues. For some reason, it doesn't respond to DNS requests unless the container has been restarted after a boot-up. Sometimes, this requires multiple restarts. I've tried to use the latest stable version and the latest edge version, both to no avail. Is there something I can do with the `restart` section in my `docker- compose.yml` to have it automatically restart periodically? ---------------------------------------------------------------------- brock0124 · 2023-12-24 19:25 Cron job? ---------------------------------------------------------------------- erin_burr · 2023-12-24 19:26 That sounds like a [cronjob](https://en.wikipedia.org/wiki/Cron). Run 'crontab -e' add a line like '\*/10 \* \* \* \* {your command here}'. I'm guessing the command will be something like "docker container restart {container name}" ("\*/10 \* \* \* \*" being the cron expression for every 10 minutes) ---------------------------------------------------------------------- GrumpyCat79 · 2023-12-24 19:28 Health checks would be better then restarting periodically, but in both case it sounds like a terrible workaround to your problem. I wouldn't personally trust that as my DNS unless you fix the root issue ---------------------------------------------------------------------- adamshand · 2023-12-24 19:34 AdGuardHome should not do this. I've been running two instances for over a year and it has never stopped responding to DNS. You need to figure out why AdGuard is stopping responding. It could be a hardware problem (eg. bad memory) or it could be something else. https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ#verboselog ---------------------------------------------------------------------- _BoNgRiPPeR_420 · 2023-12-24 20:02 Just run a cron job to restart the ID from the `docker ps` command. ---------------------------------------------------------------------- msanangelo · 2023-12-24 20:06 setup a repeating cron job that restarts the container or docker compose thing. ---------------------------------------------------------------------- JPH94 · 2023-12-24 20:08 Ofelia container thank me later :) ---------------------------------------------------------------------- CobreDev · 2023-12-24 20:09 You need to fix the root issue, not try throwing bandaids at it ---------------------------------------------------------------------- Kompost88 · 2023-12-24 20:09 Usually you need to write the whole path to command (usually `/bin/{command}` for commands running as root) when setting up cron jobs. To get a full path to command you can use `type -a {command}`. ---------------------------------------------------------------------- bufandatl · 2023-12-24 20:20 If you have an issue it’s better to fix it then do some weird workaround. Maybe start fresh and slowly add configuration changes you have done until it happens again and then analyze what the change you did actually is supposed to do. In the long run that’s better than just stupidly have a crib job restarting your container. ---------------------------------------------------------------------- mmozzano · 2023-12-24 21:31 I had an issue with my machines periodically loosing the ability to resolve DNS vi my AdguardHome/unbound configuration. It was driving me crazy. It turns out the issue was the rate limiting built into AdguardHome.. Rate limit The number of requests per second allowed per client. Setting it to 0 means no limit. Perhaps try setting that to 0 and see if it fixes your issue ---------------------------------------------------------------------- blentdragoons · 2023-12-24 21:46 why is this downvoted? this is the actual answer to the question posed by the op. ---------------------------------------------------------------------- greenbox18 · 2023-12-24 21:53 I’ve been looking for something like this for a while. I will thank you now. Thank you. 🫡 ---------------------------------------------------------------------- Illustrious-Mud-7823 · 2023-12-24 21:59 Do I need Adguard Home a license? ---------------------------------------------------------------------- JPH94 · 2023-12-24 22:16 You are very welcome. ---------------------------------------------------------------------- KN4MKB · 2023-12-24 22:23 I almost loled but saw your serious. Please don't ever try to solve a software problem by restarting it every 10 minutes. Especially a DNS server. That's insane. ---------------------------------------------------------------------- askaway0002 · 2023-12-24 22:23 No. It's FOSS. https://github.com/AdguardTeam/AdGuardHome ---------------------------------------------------------------------- askaway0002 · 2023-12-24 23:01 Well, I was hoping to create a bash script that cron would run, that would check if the server is still responsive, and if not, then, it would restart that container. ---------------------------------------------------------------------- rockchalkchuck · 2023-12-24 23:26 Is your dhcp server or other network instracture also virtualized? I've had issues when my pfsense vm wasn't finished booting before other vms started, the other vms or containers wouldn't get network addresses, and would need to be restarted again after pfsense. I fixed it by adding a long enough delay so the router is up before anything else starts. Just my experience with a similar sounding issue. ---------------------------------------------------------------------- askaway0002 · 2023-12-24 23:28 No. I’m behind an EERO router. I don’t use my own DHCP server. ---------------------------------------------------------------------- rockchalkchuck · 2023-12-24 23:33 So your eero router is pointing dns requests to your adguard container? When the adguard isn't revolving requests, are requests being resolved by a backup dns in the router settings or is nothing resolving when adguard is down? ---------------------------------------------------------------------- kindrudekid · 2023-12-25 00:47 You need more ram. Most likely. ---------------------------------------------------------------------- PaulEngineer-89 · 2023-12-25 00:58 Did you check the logs? This shouldn’t happen anyway. If you use restart: always and it faults/crashes it will just reboot over and over, only stopping if you manually stop it. One problem I’ve had is I’m running Tailscale with the primary router pointing to my Pihole instance which is mapped via the Tailscale service running on the host. So first Tailscale tries to resolve things to local names. If that doesn’t work it routes the DNS to my server then to the Pihole application on the server which then either responds or sends the request to Cloudflare. If I’m idle long enough there is a pretty good delay on the initial connection to the DNS. After that it is pretty quick. ---------------------------------------------------------------------- jeremyrem · 2023-12-25 00:59 You can do a crown, or have a bag script to test it and reboot if it fails ---------------------------------------------------------------------- Mysterious-Eagle7030 · 2023-12-25 01:34 This is a valid point, had the same issue solved by disabling DHCP in my router and setup AGH as my DHCP server, I also added a few backup DNS servers to AGH to make sure 100% stability and up time, tho with a 1g ram i do have 1-2 ms latency added. But I have to say it's stable and reliable. ---------------------------------------------------------------------- LoPanDidNothingWrong · 2023-12-25 02:43 First, launch another instance of Pihole or add in a Cloudflare DNS as backup while you fix this. Then fix it instead of doing something like this. ---------------------------------------------------------------------- broxamson · 2023-12-25 06:24 Cron job and docker compose? ---------------------------------------------------------------------- IllegalD · 2023-12-25 11:05 After you fix your AGH instance, you won't need a script 😎👉 ---------------------------------------------------------------------- Other-Technician-718 · 2023-12-25 11:21 It answers the question but does not solve the initial problem with the not responding container. It's a workaround that may cause other troubles inbthevlong run when the workaround is long forgotten. We may see a question like 'why does my container restart every 10 minutes' in maybe a few month or one, two years. ---------------------------------------------------------------------- Big-Maybe-4558 · 2023-12-27 19:49 Did you try the standalone version of AGH? It’s a single binary, even simpler to run than a docker container.