Adguard
Container
AdGuard Home is a network-wide software for blocking ads & tracking. After you set it up, it’ll cover ALL your home devices, and you don’t need any client-side software for that. With the rise of Internet-Of-Things and connected devices, it becomes more and more important to be able to control your whole network.
Image details
Configuration
TypeContainerlinuxadguard/adguardhome:latest53:53/tcp53:53/udp67:67/udp68:68/tcp68:68/udp80:80/tcp443:443/tcp853:853/tcp3000:3000/tcp/opt/adguardhome/work : /portainer/Files/AppData/Adguard/Workdir/opt/adguardhome/conf : /portainer/Files/AppData/Adguard/ConfPUID=1000PGID=100CONTEXT_PATH=adguard homeunless-stoppedTemplate by mikestraney
Standalone Install
Select an install method, to see config/commands for deploying Adguard
Install on Portainer
Import all app templates into your Portainer instance, for easy 1-click deploys
- Ensure both Docker and Portainer are installed, and up-to-date
- Log into your Portainer web UI
- Under Settings → App Templates, paste the below URL
- Head to Home → App Templates, and the list of apps will show up
- Select Adguard, fill in any config options, and hit Deploy
Template Import URL
https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me
More install options in our documentation.
Privacy protection center for you and your devices
Free and open source, powerful network-wide ads & trackers blocking DNS server.
<img src="https://cdn.adguard.com/public/Adguard/Common/adguard_home.gif" width="800" />Introduction Quick Start Update To A Newer Version Running Dev Builds Additional Configuration DHCP Server
resolvedIntroduction
AdGuard Home is a network-wide software for blocking ads and tracking. After you set it up, it'll cover all your home devices, and you won't need any client-side software for that. Learn more on our official Github repositoryagh.Quick Start
### Pull the Docker imageThis command will pull the latest stable version:
docker pull adguard/adguardhome### Create directories for persistent configuration and data
The image exposes two volumes for data and configuration persistence. You should create a data directory on a suitable volume on your host system, e.g.
/my/own/workdir, and a configuration directory on a suitable volume
on your host system, e.g. /my/own/confdir.### Create and run the container
Use the following command to create a new container and run AdGuard Home:
docker run --name adguardhome\
--restart unless-stopped\
-v /my/own/workdir:/opt/adguardhome/work\
-v /my/own/confdir:/opt/adguardhome/conf\
-p 53:53/tcp -p 53:53/udp\
-p 67:67/udp -p 68:68/udp\
-p 80:80/tcp -p 443:443/tcp -p 443:443/udp -p 3000: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/adguardhomeNow you can open the browser and navigate to http://127.0.0.1:3000/ to control your AdGuard Home service.
Don't forget to use your own data and config directories!
Ports mappings you may need:
-p 53:53/tcp -p 53:53/udp: plain DNS.-p 67:67/udp -p 68:68/tcp -p 68:68/udp: add if you intend to use AdGuardHome as a DHCP server. -p 80:80/tcp -p 443:443/tcp -p 443:443/udp -p 3000:3000/tcp: add if youare going to use AdGuard Home's admin panel as well as run AdGuard Home as
an [HTTPS/DNS-over-HTTPS][enc] server. -p 853:853/tcp: add if you are going to run AdGuard Home asa [DNS-over-TLS][enc] server. -p 784:784/udp -p 853:853/udp -p 8853:8853/udp: add if you are going torun AdGuard Home as a [DNS-over-QUIC][enc] server. You may only leave one
or two of these. -p 5443:5443/tcp -p 5443:5443/udp: add if you are going to run AdGuardHome as a [DNSCrypt] server. ### Control the containerStart:
docker start adguardhomeStop:
docker stop adguardhomeRemove:
docker rm adguardhomeUpdate To A Newer Version
- Pull the new version from Docker Hub:
```sh
docker pull adguard/adguardhome
```- Stop and remove currently running container (assuming the container is named
`adguardhome`):
```sh
docker stop adguardhome
docker rm adguardhome
```- Create and start the container using the new image using the command from
the previous section.Running Dev Builds
If you want to be on the bleeding edge, you might want to run the image from theedge or beta tags. In order to use it, simply replace adguard/adguardhome
with adguard/adguardhome:edge or adguard/adguardhome:beta in every command
from the quick start. For example:docker pull adguard/adguardhome:edgeAdditional Configuration
Upon the first run, a file namedAdGuardHome.yaml will be created, with
default values written into it. You can modify the file while your AdGuard Home
container is not running. Otherwise, any changes to the file will be lost
because the running program will overwrite them.Settings are stored in YAML, possible parameters that you can configure are listed on this pageconf.
DHCP Server
If you want to use AdGuardHome's DHCP server, you should pass--network host
argument when creating the container:docker run --name adguardhome --network host ...This option instructs Docker to use the host's network rather than a docker-bridged network. Note that port mapping with
-p is not necessary in
this case.A note from the Docker documentation:
The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.
resolved
If you try to run AdGuardHome on a system where the resolved daemon is
started, docker will fail to bind on port 53, because resolved daemon is
listening on 127.0.0.53:53. Here's how you can disable DNSStubListener on
your machine:- Deactivate
DNSStubListenerand update the DNS server address. Create
a new file, `/etc/systemd/resolved.conf.d/adguardhome.conf` (creating
the `/etc/systemd/resolved.conf.d` directory if needed) and add the
following content to it:
```none
[Resolve]
DNS=127.0.0.1
DNSStubListener=no
```
Specifying `127.0.0.1` as the DNS server address is necessary because
otherwise the nameserver will be `127.0.0.53` which doesn't work without
`DNSStubListener`.- Activate a new
resolv.conffile:
```sh
mv /etc/resolv.conf /etc/resolv.conf.backup
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
```- Stop
DNSStubListener:
```sh
systemctl reload-or-restart systemd-resolved
```Serve Adguard on your own domain behind Caddy, Nginx or Traefik. Fill in your domain and copy the result. It's a starting point, some apps need their own base URL or extra headers set too.
Proxying adguard.example.com to http://adguard:80
Add this to your Caddyfile
adguard.example.com {
reverse_proxy http://adguard:80
}Check the logs first
Nine times out of ten the logs tell you exactly what went wrong.
- In Portainer, go to Containers, click the container, then Logs. Or run
docker logs adguard - Exit codes help too:
137means killed, usually out of memory.126or127means the command inside the image is broken.
Port already in use
If deployment fails with "Bind for 0.0.0.0:53 failed: port is already allocated", something else on your server is using that port.
- Find what's using it:
sudo ss -tlnp | grep :53 - Stop the other service, or pick a different host port. In
53:53only the left number is yours to change, the right one belongs to the app.
Running but the page won't load
The container is up but nothing appears in your browser.
- Use your server's real IP:
http://your-server-ip:80. The 0.0.0.0 link Portainer shows isn't a real address. - Give it a minute after first deploy, adguard can take a while to initialise.
- Make sure your firewall allows the port, e.g.
sudo ufw allow 80
Permission denied on volumes
If the logs show "permission denied", the app can't write to its data folder on the host.
- Fix the ownership:
sudo chown -R 1000:100 /portainer/Files/AppData/Adguard/Workdir(and the same for the other mapped folders) - Or set the
PUIDandPGIDvariables (defaults 1000:100) to match your own user, found withid $USER
Image won't pull
Test the pull directly on the host: docker pull adguard/adguardhome:latest
- "manifest unknown" means the tag no longer exists. This template uses
latest, so try pinning a specific version instead. - "toomanyrequests" is the Docker Hub rate limit. Log in with
docker loginto raise it. - "no space left on device" means a full disk. Reclaim space with
docker system prune
"exec format error"
This means the image was built for a different CPU architecture than your server.
- This image supports:
amd64, arm64, arm/v7, arm/v6, 386, ppc64le - Check yours with
uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.
Container keeps restarting
The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.
- Check the logs right after a restart, the last few lines before it died are the useful ones.
- Get the exit code with
docker inspect adguard --format '{{.State.ExitCode}}' - Still stuck? Redeploy once with the restart policy set to
noso the failure stays visible.
Raise an issue
Found something which isn't working as it should? Here's how to report it.
- Bug within the app: Open an issue within adguard's repo
- Template not working: Open an issue on mikestraney/portainer-templates
- This website not working: Open an issue on lissy93/portainer-templates
A single container
Adguard runs as one container, the simplest kind of app here. Just the one image to pull and nothing else wired up alongside it.
The app image
An image is the app packed up ready to go, everything Adguard needs bundled into one download. This template pulls adguard/adguardhome:latest, which Docker fetches once (about 27 MB) and then starts your own copy from.
Where the image comes from
Docker pulls its images from registries, public libraries of ready-built apps. Adguard's comes from Docker Hub, published by adguard.
Version tags
The bit after the colon in the image name is the version tag. Here it's latest, which always points at the newest build, so a redeploy can bump you to a newer release without you asking. Newest right now is v0.108.0-b.90. Pin a specific tag if you would rather stay on one version.
Which machines it runs on
Every image is built for particular CPU types. This one ships for amd64, arm64, arm/v7, arm/v6, 386, ppc64le, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.
Ports
A port is the door the app answers on. A mapping like 53:53 means it's reachable on port 53 of your server, where the left number is yours to change and the right one belongs to the app. Once it's running, open http://your-server-ip:80 in a browser. It opens:
53:5353:53over UDP67:67over UDP68:6868:68over UDP80:80, likely the web interface443:443, likely the web interface853:8533000:3000, likely the web interface
Volumes
A volume is where Adguard keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:
/opt/adguardhome/workfrom/portainer/Files/AppData/Adguard/Workdiron the host/opt/adguardhome/conffrom/portainer/Files/AppData/Adguard/Confon the host
Environment variables
Environment variables are the settings you hand over when you deploy, things like a password or a timezone. Adguard takes 3 of them, all with defaults you can leave alone or tweak:
PUID, defaults to1000PGID, defaults to100CONTEXT_PATH, defaults toadguard home
Restart policy
The restart policy here is unless-stopped, so Docker restarts Adguard after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).
Users and permissions
The PUID and PGID settings tell it which user and group to act as on your host. Point them at your own account (find yours with id $USER) so the files it writes into your mounted folders come out owned by you rather than root.
Networking
Nothing custom is set, so Adguard sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.
Container name
Once it's deployed, Portainer names the container adguard. That's what you'll spot in the containers list and use in commands like docker logs adguard.
Platform
The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.
Portainer app templates
Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set Adguard up. Add the template list to Portainer once, then deploying Adguard is a click rather than a wall of config.