Sign inSign up

lkpot/adguardhome

By lkpot

•Updated 4 months ago

A docker image to run AdGuardHome as a non-root user

Image
0

1.5K

lkpot/adguardhome repository overview

⁠Overview

AdGuard Home build from source to run as a non-root user.

For full details, visit the github repository⁠

⁠Quick Start

⁠Create a new user for AdGuard Home
This user will later be mapped into the container.
useradd -M --system -s /usr/sbin/nologin adguardhome
⁠AdGuard Home data directory and first start
AdGuard Home requires to be run as root on the first start.
docker run --rm --cap-drop ALL --cap-add CAP_NET_BIND_SERVICE \
           -v ./etc-adguardhome:/etc/adguardhome --user 0:0 \
           lkpot/adguardhome

Once the container runs, perform the initial setup via http://<server_address>:3000 Make sure to change the ownership of the created data directory to the earlier created adguardhome user.

chown -R "$(id -u adguardhome):$(id -g adguardhome)" etc-adguardhome
⁠Starting the container
docker run --rm --cap-drop ALL --cap-add CAP_NET_BIND_SERVICE \
           -v ./etc-adguardhome:/etc/adguardhome --user "$(id -u adguardhome):$(id -g adguardhome) \
           lkpot/adguardhome
⁠docker-compose.yaml

For docker compose, you may want to create an environment file (.env)⁠ for easier user mapping.

echo -e "UID=$(id -u adguardhome )\nGID=$(id -g adguardhome )" > .env
services:
  adguard:
    container_name: adguardhome

    image: lkpot/adguardhome

    cap_drop:
      - All

    cap_add:
      - CAP_NET_BIND_SERVICE

    expose:
      - 53:53/tcp
      - 53:53/udp
      - 80:80/tcp
      - 443:443/tcp

    user: ${UID}:${GID}

    volumes:
      - ./etc-adguardhome:/etc/adguardhome

    restart: unless-stopped

Tag summary

Content type

Image

Digest

sha256:4eba190d3…

Size

41.8 MB

Last updated

4 months ago

docker pull lkpot/adguardhome