---
title: 'How to install AdGuard Home in Docker | Zomro'
description: 'Advertising and trackers can follow you. In most cases, advertising may be inappropriate.'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669736570_1.png'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * How to install AdGuard Home in Docker 



# How to install AdGuard Home in Docker

21-11-2022

Advertising and trackers can follow you. In most cases, advertising may be inappropriate. Thanks to trackers, your personal information will be used to determine the most effective way to sell you any product. Both banner ads and trackers slow down the browser, interfere with, and degrade the online experience.   
  
AdGuard Home is software that provides security for your network and blocks ads and trackers. In this article, we will look at how to install it in a Docker container, also using docker-compose.  


**Let's install Docker.**

Update the OS packages.   

    
    
    apt update

  
We will install the necessary packages and add a new repository:
    
    
    apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

  
We will update the packages with the new repository:
    
    
    apt update

  
Now let's install Docker.
    
    
    apt-get install docker-ce docker-ce-cli containerd.io

  
Let's check the version:
    
    
    docker --version

  
![How to install AdGuard Home in Docker - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669736570_1.png)  
  
Let's check the status:
    
    
    systemctl status docker

  
![How to install AdGuard Home in Docker - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669736593_2.png)  
  
If it hasn't started, we start it:
    
    
    systemctl start docker
    

  
And add it to autostart.
    
    
    systemctl enable docker
    

![How to install AdGuard Home in Docker - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669736594_4.png)

**Let's install Docker-Compose**

  
For this project, version 1.25 will be sufficient. 
    
    
    curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    

  
We set the execution permissions. 
    
    
    chmod +x /usr/local/bin/docker-compose
    

  
Let's check how Docker-Compose was installed:
    
    
    docker-compose --version
    

  
![How to install AdGuard Home in Docker - 4](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669740139_5.png)  
  
  
Add the Linux user to the **docker** group:
    
    
    usermod -aG docker $USER
    

  
Let's create a ***.yaml** file for Docker-Compose.  
  
To keep track of what we have installed in the future, let's create a separate folder for this project in the **/home** directory and navigate to it.
    
    
    mkdir /home/adguardhome && cd /home/adguardhome

  
You can also use another directory**** to place this and other projects.   
  
Let's use the repository to create the **docker-compose.yaml** file at the link <https://hub.docker.com/r/adguard/adguardhome>  
  
Create the file **docker-compose.yaml** or **docker-compose.yml** ,
    
    
    vim docker-compose.yaml
    

  
And add the following code to it:
    
    
    version: '3.3'
    services:
        adguardhome:
            image: adguard/adguardhome
            container_name: adguardhome
            volumes:
                - /opt/adguardhome/work:/opt/adguardhome/work
                - /opt/adguardhome/conf:/opt/adguardhome/conf
            ports:
                - 53:53/tcp
                - 53:53/udp
                - 67:67/udp
                - 68:68/udp
                - 80:80/tcp
                - 443:443/tcp
                - 443:443/udp
                - 3000:3000/tcp
                - 853:853/tcp
                - 784:784/udp
                - 853:853/udp
                - 8853:8853/udp
                - 5443:5443/tcp
                - 5443:5443/udp
            restart: always

Where:  
  
**container_name** : the name of your container;  
In the **volumes** block, specify the paths where the configuration files will be available;  
In the **ports** block, the ports that need to be forwarded to the container are specified.  
  
  
Run the script (to do this, you need to be in the directory where our file was created. In this case, it is **/home/adguardhome/**):
    
    
    docker-compose up -d 
    

  
Wait for the images to download and deploy.  
  
Check:
    
    
    docker-compose ps
    

  
Or:
    
    
    docker ps
    

  
![How to install AdGuard Home in Docker - 5](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/12/01/1671549833_screenshot_12.png)  
You can also install adguardhome with a single command without using **docker compose.**
    
    
    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/adguardhome

  
Now, to access the administration panel, you need to disable DNSStubListener on the server. To do this, create a directory and a new file:
    
    
    mkdir -p  /etc/systemd/resolved.conf.d
    
    
    vim /etc/systemd/resolved.conf.d/adguardhome.conf

  
And add the following code to it:  

    
    
    [Resolve]
    DNS=127.0.0.1
    DNSStubListener=no

  
To activate resolve.conf, execute the following commands:
    
    
    mv /etc/resolv.conf /etc/resolv.conf.backup
    ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

  
Update DNSStubListener:
    
    
    systemctl reload-or-restart systemd-resolved

  
Now we can use our IP to connect to adguardhome and complete the installation. After that, you can log in with the credentials you entered during installation.   
  
![How to install AdGuard Home in Docker - 6](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/12/01/1671551457_screenshot_1.png)  
You will see a picture similar to this in your personal account.   
  
![How to install AdGuard Home in Docker - 7](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/12/01/1671552389_screenshot_2.png)  
To make adguardhome start blocking ads, enter the server IP where adguardhome is located in the DNS field. This can be done both in the router and on your personal PC.  
  
![How to install AdGuard Home in Docker - 8](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/12/01/1671552960_1671552878.png)  
Happy surfing without trackers and ads.

Similar articles:

[Cleaning up old logs and temporary files on Linux servers](https://zomro.com/blog/faq/371-cleaning-up-old-logs-and-temporary-files-on-linux-servers) [Reset password in VMware ESXi 6](https://zomro.com/blog/faq/344-reset-password-in-vmware-esxi-6) [How to set up a Samba server on Windows Server and connect to it from Windows Server 2019](https://zomro.com/blog/faq/333-how-to-set-up-a-samba-server-on-windows-server-and-connect-to-it-from-windows-server-2019) [How to connect to a server via FTP, SFTP, and SCP](https://zomro.com/blog/faq/144-kak-podkljuchitsja-k-serveru-po-ftp-sftp-i-scp) [How to install and configure fail2ban in Centos 7](https://zomro.com/blog/faq/366-how-to-install-and-configure-fail2ban-in-centos-7)

[ Virtual hosting from €3.98/mon ](/virtual)
