Installing AdGuard on Raspberry Pi 4 using Docker

Learn how to install AdGuard on a Raspberry Pi using Docker for ad-blocking and enhanced privacy. Simplified steps in this guide.

Introduction

AdGuard is a popular ad-blocking software that helps protect your devices from intrusive ads, malware, and tracking. In this guide, we will walk you through the process of installing AdGuard on a Raspberry Pi using Docker, a containerization platform that simplifies software deployment.

Prerequisites:

Before proceeding, make sure you have the following:

  • A Raspberry Pi board (any model will work)

  • Raspberry Pi OS installed and configured

  • Docker installed on your Raspberry Pi

Step 1: Set up Docker on Raspberry Pi

  1. Connect to your Raspberry Pi via SSH or use the command line directly.

  2. Install Docker on your Raspberry Pi by running the following command:

    curl -sSL https://get.docker.com | sh
  3. Add your user to the Docker group to run Docker commands without using sudo:

    sudo usermod -aG docker your_username

    Replace "your_username" with your actual username.

Step 2: Create a Docker Compose file

  1. Create a new directory to store your Docker Compose file:

    mkdir adguard
    cd adguard
  2. Use a text editor to create a file named "docker-compose.yml" inside the "adguard" directory.

  3. Open the "docker-compose.yml" file and paste the following configuration:

    version: '3'
    services:
      adguard:
        image: adguard/adguardhome
        restart: always
        ports:
          - 80:80
          - 443:443
          - 53:53/udp
        volumes:
          - ./adguard/work:/opt/adguardhome/work
          - ./adguard/conf:/opt/adguardhome/conf

    This configuration sets up the AdGuard container, maps the necessary ports, and creates two volumes to persist the AdGuard data.

Step 3: Start the AdGuard container

  1. Save the "docker-compose.yml" file and exit the text editor.

  2. Start the AdGuard container by running the following command:

    docker-compose up -d

    Docker Compose will download the AdGuard image and create the container based on the configuration in the YAML file.

Step 4: Access AdGuard web interface

  1. Open a web browser on your computer and enter your Raspberry Pi's IP address.

  2. AdGuard's web interface should be accessible at http://<your_raspberry_pi_ip>.

  3. Follow the on-screen instructions to set up AdGuard and customize its filtering options.