AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home/overview.html
GNU General Public License v3.0
25.64k stars 1.84k forks source link

Restarting PC Resets AdGuard Server Setup, While Stopping and Restarting Service from Docker Desktop works fine #7132

Closed chlw2123 closed 4 months ago

chlw2123 commented 4 months ago

Prerequisites

Platform (OS and CPU architecture)

Windows, AMD64 (aka x86_64)

Installation

Docker

Setup

On one machine

AdGuard Home version

latest

Action

Followed the guide here.

https://hub.docker.com/r/adguard/adguardhome

My setup: Windows 11 64bit running docker through WSL2

This is my docker run command:

docker run --name adguardhome\
--restart always\
-v ~/adguardhome/work:/opt/adguardhome/work\
-v ~/adguardhome/conf:/opt/adguardhome/conf\
-p 53:53/tcp -p 53:53/udp\
-p 67:67/udp -p 68:68/udp\
-p 35351:80/tcp -p 35352:443/tcp -p 35353:443/udp -p 35354:3000/tcp\
-p 853:853/tcp\
-p 784:784/udp -p 853:853/udp -p 8853:8853/udp\
-p 5443:5443/tcp -p 5443:5443/udp\
-d adguard/adguardhome

Expected result

So after running this and setting the DNS server address on my router to be my PC's local network address, and finishing with the setup on localhost:35354 which is mapped to port 3000. I can then access localhost:35351 which is mapped to port 80 and see the DNS queries made and some of the sites blocked working correctly. Also verified that the configuration files persisted in both directories both before and after a PC restart.

-v ~/adguardhome/work -v ~/adguardhome/conf

If I restart my PC and afterwards have the adguardhome service automatically starts with it, I expect to be able to access the dashboard, localhost:35351.

Actual result

However, after I restart the PC, and with the adguardhome service now running, I cannot access localhost:35351 anymore but I can access localhost:35354 which will prompt me to set up adguardhome once again but I did not have to do that. Stopping the adguardhome service and starting it back again allow access to the dashboard, localhost:35351 once again.

Not too sure if there is anything wrong with my setup or it's just a known problem with WSL2?

Additional information and/or screenshots

No response

tjharman commented 4 months ago

I don't think this is an AdGuardHome problem, more likely an issue with docker. Potentially when the PC/Server is starting up Docker isn't setting up ports/permissions properly, maybe some service Windows Docker requires hasn't started yet. But then when you go to do it manually, it has and it works now.

Actually, I expect maybe the problem is the ~/ you have in your command. On bootup how will Docker know what user you are, it has to wait until you're logged in to know that. Try filling out c:\users\bob\ or whatever the WSL equivalent is and see if that resolves the issue.

he-pennypacker commented 4 months ago

Actually, I expect maybe the problem is the ~/ you have in your command. On bootup how will Docker know what user you are, it has to wait until you're logged in to know that. Try filling out c:\users\bob\ or whatever the WSL equivalent is and see if that resolves the issue.

Yes, that's my thought too. Set an absolute path

chlw2123 commented 4 months ago

@tjharman

Yup, the issues is fixed after turning off the auto-start option and changing the paths to paths to docker volumes instead.

tjharman commented 4 months ago

Great, I will close this ticket.