---
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](http://zomro.com/)
  * [FAQ](http://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.  


ZOMRO / contact form

Need help from a system administrator? 

Describe the issue and we will get back to you within 15 minutes.

Your name 

Your email 

Phone 

Describe the problem 

LEAVE A REQUEST →  [ ![](/static/site/imagesNew/svg/telegram-btn-icon.svg?v=1793704481) Message us on Telegram ](https://t.me/zomro_sysadmin)

You can find the full list of services and prices on the page [ Server administration and maintenance services. ](/paid-support-services/server-management-services)

**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:

[How to change the SSH connection port and disable password authorization](http://zomro.com/blog/faq/236-kak-izmenit-port-podkljuchenija-po-ssh-i-otkljuchit-avtorizaciju-po-parolju) [What is FTP and how to use it to upload files to a server?](http://zomro.com/blog/faq/543-what-is-ftp-and-how-do-i-use-it-to-upload-files-to-a-server) [Installing the Pterodactyl Control Panel (Ubuntu)](http://zomro.com/blog/faq/358-installing-the-pterodactyl-control-panel-ubuntu) [How to trace](http://zomro.com/blog/faq/331-kak-proizvesti-trassirovku) [Linux dig command - usage and examples.](http://zomro.com/blog/faq/404-linux-d-command-usage-examples)

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

![](/static/site/imagesNew/blogSupport/popup-server.avif?v=1793704481)

ZOMRO / SERVER MANAGEMENT

Need a sysadmin's help? 

Describe the issue and we will get back to you within 15 minutes.

Your name 

Your email 

Phone 

Describe the problem 

LEAVE A REQUEST →  [ ![](/static/site/imagesNew/svg/telegram-btn-icon.svg?v=1793704481) Message us on Telegram ](https://t.me/zomro_sysadmin)

You can find the full list of services and prices on the page [ Server administration and maintenance services. ](/paid-support-services/server-management-services)

Your data has been successfully sent!

Thank you for contacting us. We will get back to you shortly.

Got it! 
