[GH-ISSUE #1685] Bug: dns and therefor pihole does not work as described when running on a docker swarm #2516

Open
opened 2026-03-01 17:59:34 +03:00 by kerem · 0 comments
Owner

Originally created by @imi-kitten on GitHub (Jul 7, 2025).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1685

Originally assigned to: @pirate on GitHub.

Provide a screenshot and describe the bug

since ipv4_address is not implemented on the swarm side for the networking, the setup using the pihole as dns fails to fetch any archives as it fails dns lookup every time,

Steps to reproduce

have docker swarm running attempt to deploy using included docker-compose with pihole options uncommented

Logs or errors


ArchiveBox Version

latest

How did you install the version of ArchiveBox you are using?

Docker (or Podman/LXC/K8s/TrueNAS/Proxmox/etc)

What operating system are you running on?

Linux (Ubuntu/Debian/Arch/Alpine/etc.)

What type of drive are you using to store your ArchiveBox data?

  • some of data/ is on a local SSD or NVMe drive
  • some of data/ is on a spinning hard drive or external USB drive
  • some of data/ is on a network mount (e.g. NFS/SMB/Ceph/GlusterFS/etc.)
  • some of data/ is on a FUSE mount (e.g. SSHFS/RClone/S3/B2/Google Drive/Dropbox/etc.)

Docker Compose Configuration

# Usage:
#     mkdir -p ~/archivebox/data && cd ~/archivebox
#     curl -fsSL 'https://docker-compose.archivebox.io' > docker-compose.yml
#     docker compose run archivebox version
#     docker compose run archivebox config --set SAVE_ARCHIVE_DOT_ORG=False
#     docker compose run archivebox add --depth=1 'https://news.ycombinator.com'
#     docker compose run -T archivebox add < bookmarks.txt
#     docker compose up -d && open 'https://localhost:8000'
#     docker compose run archivebox help
# Documentation:
#     https://github.com/ArchiveBox/ArchiveBox/wiki/Docker#docker-compose
services:
  archivebox:
    image: archivebox/archivebox:latest
    ports:
      - 4141:8000
    volumes:
      - /mnt/media/archivebox/archive:/data/archive
      - /local-mnt/docker/archivebox/data/:/data
      # ./data/personas/Default/chrome_profile/Default:/data/personas/Default/chrome_profile/Default
    environment:
      - ADMIN_USERNAME=admin            # creates an admin user on first run with the given user/pass combo
      - ADMIN_PASSWORD=xxxxxxxxxxxxxxxxxxx
      - ALLOWED_HOSTS=* # set this to the hostname(s) you're going to serve the site from!
      - CSRF_TRUSTED_ORIGINS=https://archivebox.extenal.site # you MUST set this to the server's URL for admin login and the REST API to work
      - PUBLIC_INDEX=False # set to False to prevent anonymous users from viewing snapshot list
      - PUBLIC_SNAPSHOTS=False # set to False to prevent anonymous users from viewing snapshot content
      - PUBLIC_ADD_VIEW=False # set to True to allow anonymous users to submit new URLs to archive
      - SEARCH_BACKEND_ENGINE=sonic # tells ArchiveBox to use sonic container below for fast full-text search
      - SEARCH_BACKEND_HOST_NAME=sonic
      - SEARCH_BACKEND_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - PUID=1000 # set to your host user's UID & GID if you encounter permissions issues
      - PGID=1000 # UID/GIDs lower than 500 may clash with system uids and are not recommended
      # For options below, it's better to set in data/ArchiveBox.conf or use `docker compose run archivebox config --set SOME_KEY=someval` instead of setting here:
      # - MEDIA_MAX_SIZE=750m             # increase this filesize limit to allow archiving larger audio/video files
      # - TIMEOUT=60                      # increase this number to 120+ seconds if you see many slow downloads timing out
      # - CHECK_SSL_VALIDITY=True         # set to False to disable strict SSL checking (allows saving URLs w/ broken certs)
      # - SAVE_ARCHIVE_DOT_ORG=True       # set to False to disable submitting all URLs to Archive.org when archiving
      # - USER_AGENT="..."                # set a custom USER_AGENT to avoid being blocked as a bot
      # ...
      # For more info, see: https://github.com/ArchiveBox/ArchiveBox/wiki/Docker#configuration
    # For ad-blocking during archiving, uncomment this section and the pihole service below
    networks:
      - dns
      - traefik-public
    dns:
      - 172.20.0.53
    deploy:
      labels:
        - traefik.enable=true
        - traefik.swarm.network=traefik-public
        - traefik.http.routers.archivebox-internal.rule=Host(`archivebox.internal`)
        - traefik.http.routers.archivebox-internal.entrypoints=http
        - traefik.http.services.archivebox-main.loadbalancer.server.port=8000
        - traefik.http.routers.archivebox-external-http.rule=Host(`archivebox.external.site`)
        - traefik.http.routers.archivebox-external-http.entrypoints=http
        - traefik.http.routers.archivebox-external-http.middlewares=https-redirect
        - traefik.http.routers.archivebox-external-https.entrypoints=https
        - traefik.http.routers.archivebox-external-https.rule=Host(`archivebox.external.site`)
        - traefik.http.routers.archivebox-external-https.tls=true
        - traefik.http.routers.archivebox-external-https.tls.certresolver=le
      placement:
        constraints:
          - node.labels.local-data==docker-dir
  ######## Optional Addons: tweak examples below as needed for your specific use case ########

  ### This optional container runs scheduled jobs in the background (and retries failed ones). To add a new job:
  #   $ docker compose run archivebox schedule --add --every=day --depth=1 'https://example.com/some/rss/feed.xml'
  # then restart the scheduler container to apply any changes to the scheduled task list:
  #   $ docker compose restart archivebox_scheduler
  # https://github.com/ArchiveBox/ArchiveBox/wiki/Scheduled-Archiving
  archivebox_scheduler:
    image: archivebox/archivebox:latest
    command: schedule --foreground --update --every=day
    environment:
      - PUID=1000 # set to your host user's UID & GID if you encounter permissions issues
      - PGID=1000
      - TIMEOUT=120 # use a higher timeout than the main container to give slow tasks more time when retrying
      - SEARCH_BACKEND_ENGINE=sonic # tells ArchiveBox to use sonic container below for fast full-text search
      - SEARCH_BACKEND_HOST_NAME=sonic
      - SEARCH_BACKEND_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      # For other config it's better to set using `docker compose run archivebox config --set SOME_KEY=someval` instead of setting here
      # ...
      # For more info, see: https://github.com/ArchiveBox/ArchiveBox/wiki/Docker#configuration
    volumes:
      - /mnt/media/archivebox/archive:/data/archive
      - /local-mnt/docker/archivebox/data/:/data
    restart: always
    deploy:
      placement:
        constraints:
          - node.labels.local-data==docker-dir
  ### This runs the optional Sonic full-text search backend (much faster than default rg backend).
  # If Sonic is ever started after not running for a while, update its full-text index by running:
  #   $ docker-compose run archivebox update --index-only
  # https://github.com/ArchiveBox/ArchiveBox/wiki/Setting-up-Search
  sonic:
    image: archivebox/sonic:latest
    expose:
      - 1491
    environment:
      - SEARCH_BACKEND_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    volumes:
      # - /ceph/docker-data/archivebox/sonic.cfg:/etc/sonic.cfg:ro # mount to customize: https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/stable/etc/sonic.cfg
      - /ceph/docker-data/archivebox/data/sonic:/var/lib/sonic/store
  ### This optional container runs xvfb+noVNC so you can watch the ArchiveBox browser as it archives things,
  # or remote control it to set up a chrome profile w/ login credentials for sites you want to archive.
  # https://github.com/ArchiveBox/ArchiveBox/wiki/Chromium-Install#setting-up-a-chromium-user-profile
  # https://github.com/ArchiveBox/ArchiveBox/wiki/Chromium-Install#docker-vnc-setup
  novnc:
    image: theasp/novnc:latest
    environment:
      - DISPLAY_WIDTH=1920
      - DISPLAY_HEIGHT=1080
      - RUN_XTERM=no
    ports:
      - 4040:8080
      # to view/control ArchiveBox's browser, visit: http://127.0.0.1:8080/vnc.html
      # restricted to access from localhost by default because it has no authentication
      ### Example: To run pihole in order to block ad/tracker requests during archiving,
      # uncomment this optional block and set up pihole using its admin interface
    deploy:
      labels:
        - traefik.enable=true
        - traefik.swarm.network=traefik-public
        - traefik.http.routers.archivebox-vnc.rule=Host(`archivebox-vnc.internal`)
        - traefik.http.routers.archivebox-vnc.entrypoints=http
        - traefik.http.services.archivebox-vnc.loadbalancer.server.port=8080

  pihole:
    image: pihole/pihole:latest
    ports:
      # access the admin HTTP interface on http://localhost:8090
      - 8191:80
    environment:
      - WEBPASSWORD=NormalPassword01
      - DNSMASQ_LISTENING=all
    dns:
      - 127.0.0.1
      - 1.1.1.1
    networks:
      dns:
        ipv4_address:172.20.0.53
      traefik-public:
    volumes:
      - /ceph/docker-data/archivebox/etc/pihole:/etc/pihole
      - /ceph/docker-data/archivebox/etc/dnsmasq:/etc/dnsmasq.d
    deploy:
      labels:
        - traefik.enable=true
        - traefik.swarm.network=traefik-public
        - traefik.http.routers.archivebox-pihole.rule=Host(`archivebox-pihole.internal`)
        - traefik.http.routers.archivebox-pihole.entrypoints=http
        - traefik.http.services.archivebox-pihole.loadbalancer.server.port=80

  changedetection:
    image: ghcr.io/dgtlmoon/changedetection.io
    volumes:
      - /ceph/docker-data/archivebox/data-changedetection:/datastore

networks:
  # network just used for pihole container to offer :53 dns resolving on fixed ip for archivebox container
  dns:
    ipam:
      driver: default
      config:
        - subnet: 172.20.0.0/20
  traefik-public:
    external: true

ArchiveBox Configuration


Originally created by @imi-kitten on GitHub (Jul 7, 2025). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1685 Originally assigned to: @pirate on GitHub. ### Provide a screenshot and describe the bug since `ipv4_address` is not implemented on the swarm side for the networking, the setup using the pihole as dns fails to fetch any archives as it fails dns lookup every time, ### Steps to reproduce ```markdown have docker swarm running attempt to deploy using included docker-compose with pihole options uncommented ``` ### Logs or errors ```shell ``` ### ArchiveBox Version ```shell latest ``` ### How did you install the version of ArchiveBox you are using? Docker (or Podman/LXC/K8s/TrueNAS/Proxmox/etc) ### What operating system are you running on? Linux (Ubuntu/Debian/Arch/Alpine/etc.) ### What type of drive are you using to store your ArchiveBox data? - [ ] some of `data/` is on a local SSD or NVMe drive - [x] some of `data/` is on a spinning hard drive or external USB drive - [x] some of `data/` is on a network mount (e.g. NFS/SMB/Ceph/GlusterFS/etc.) - [ ] some of `data/` is on a FUSE mount (e.g. SSHFS/RClone/S3/B2/Google Drive/Dropbox/etc.) ### Docker Compose Configuration ```shell # Usage: # mkdir -p ~/archivebox/data && cd ~/archivebox # curl -fsSL 'https://docker-compose.archivebox.io' > docker-compose.yml # docker compose run archivebox version # docker compose run archivebox config --set SAVE_ARCHIVE_DOT_ORG=False # docker compose run archivebox add --depth=1 'https://news.ycombinator.com' # docker compose run -T archivebox add < bookmarks.txt # docker compose up -d && open 'https://localhost:8000' # docker compose run archivebox help # Documentation: # https://github.com/ArchiveBox/ArchiveBox/wiki/Docker#docker-compose services: archivebox: image: archivebox/archivebox:latest ports: - 4141:8000 volumes: - /mnt/media/archivebox/archive:/data/archive - /local-mnt/docker/archivebox/data/:/data # ./data/personas/Default/chrome_profile/Default:/data/personas/Default/chrome_profile/Default environment: - ADMIN_USERNAME=admin # creates an admin user on first run with the given user/pass combo - ADMIN_PASSWORD=xxxxxxxxxxxxxxxxxxx - ALLOWED_HOSTS=* # set this to the hostname(s) you're going to serve the site from! - CSRF_TRUSTED_ORIGINS=https://archivebox.extenal.site # you MUST set this to the server's URL for admin login and the REST API to work - PUBLIC_INDEX=False # set to False to prevent anonymous users from viewing snapshot list - PUBLIC_SNAPSHOTS=False # set to False to prevent anonymous users from viewing snapshot content - PUBLIC_ADD_VIEW=False # set to True to allow anonymous users to submit new URLs to archive - SEARCH_BACKEND_ENGINE=sonic # tells ArchiveBox to use sonic container below for fast full-text search - SEARCH_BACKEND_HOST_NAME=sonic - SEARCH_BACKEND_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx - PUID=1000 # set to your host user's UID & GID if you encounter permissions issues - PGID=1000 # UID/GIDs lower than 500 may clash with system uids and are not recommended # For options below, it's better to set in data/ArchiveBox.conf or use `docker compose run archivebox config --set SOME_KEY=someval` instead of setting here: # - MEDIA_MAX_SIZE=750m # increase this filesize limit to allow archiving larger audio/video files # - TIMEOUT=60 # increase this number to 120+ seconds if you see many slow downloads timing out # - CHECK_SSL_VALIDITY=True # set to False to disable strict SSL checking (allows saving URLs w/ broken certs) # - SAVE_ARCHIVE_DOT_ORG=True # set to False to disable submitting all URLs to Archive.org when archiving # - USER_AGENT="..." # set a custom USER_AGENT to avoid being blocked as a bot # ... # For more info, see: https://github.com/ArchiveBox/ArchiveBox/wiki/Docker#configuration # For ad-blocking during archiving, uncomment this section and the pihole service below networks: - dns - traefik-public dns: - 172.20.0.53 deploy: labels: - traefik.enable=true - traefik.swarm.network=traefik-public - traefik.http.routers.archivebox-internal.rule=Host(`archivebox.internal`) - traefik.http.routers.archivebox-internal.entrypoints=http - traefik.http.services.archivebox-main.loadbalancer.server.port=8000 - traefik.http.routers.archivebox-external-http.rule=Host(`archivebox.external.site`) - traefik.http.routers.archivebox-external-http.entrypoints=http - traefik.http.routers.archivebox-external-http.middlewares=https-redirect - traefik.http.routers.archivebox-external-https.entrypoints=https - traefik.http.routers.archivebox-external-https.rule=Host(`archivebox.external.site`) - traefik.http.routers.archivebox-external-https.tls=true - traefik.http.routers.archivebox-external-https.tls.certresolver=le placement: constraints: - node.labels.local-data==docker-dir ######## Optional Addons: tweak examples below as needed for your specific use case ######## ### This optional container runs scheduled jobs in the background (and retries failed ones). To add a new job: # $ docker compose run archivebox schedule --add --every=day --depth=1 'https://example.com/some/rss/feed.xml' # then restart the scheduler container to apply any changes to the scheduled task list: # $ docker compose restart archivebox_scheduler # https://github.com/ArchiveBox/ArchiveBox/wiki/Scheduled-Archiving archivebox_scheduler: image: archivebox/archivebox:latest command: schedule --foreground --update --every=day environment: - PUID=1000 # set to your host user's UID & GID if you encounter permissions issues - PGID=1000 - TIMEOUT=120 # use a higher timeout than the main container to give slow tasks more time when retrying - SEARCH_BACKEND_ENGINE=sonic # tells ArchiveBox to use sonic container below for fast full-text search - SEARCH_BACKEND_HOST_NAME=sonic - SEARCH_BACKEND_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx # For other config it's better to set using `docker compose run archivebox config --set SOME_KEY=someval` instead of setting here # ... # For more info, see: https://github.com/ArchiveBox/ArchiveBox/wiki/Docker#configuration volumes: - /mnt/media/archivebox/archive:/data/archive - /local-mnt/docker/archivebox/data/:/data restart: always deploy: placement: constraints: - node.labels.local-data==docker-dir ### This runs the optional Sonic full-text search backend (much faster than default rg backend). # If Sonic is ever started after not running for a while, update its full-text index by running: # $ docker-compose run archivebox update --index-only # https://github.com/ArchiveBox/ArchiveBox/wiki/Setting-up-Search sonic: image: archivebox/sonic:latest expose: - 1491 environment: - SEARCH_BACKEND_PASSWORD=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx volumes: # - /ceph/docker-data/archivebox/sonic.cfg:/etc/sonic.cfg:ro # mount to customize: https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/stable/etc/sonic.cfg - /ceph/docker-data/archivebox/data/sonic:/var/lib/sonic/store ### This optional container runs xvfb+noVNC so you can watch the ArchiveBox browser as it archives things, # or remote control it to set up a chrome profile w/ login credentials for sites you want to archive. # https://github.com/ArchiveBox/ArchiveBox/wiki/Chromium-Install#setting-up-a-chromium-user-profile # https://github.com/ArchiveBox/ArchiveBox/wiki/Chromium-Install#docker-vnc-setup novnc: image: theasp/novnc:latest environment: - DISPLAY_WIDTH=1920 - DISPLAY_HEIGHT=1080 - RUN_XTERM=no ports: - 4040:8080 # to view/control ArchiveBox's browser, visit: http://127.0.0.1:8080/vnc.html # restricted to access from localhost by default because it has no authentication ### Example: To run pihole in order to block ad/tracker requests during archiving, # uncomment this optional block and set up pihole using its admin interface deploy: labels: - traefik.enable=true - traefik.swarm.network=traefik-public - traefik.http.routers.archivebox-vnc.rule=Host(`archivebox-vnc.internal`) - traefik.http.routers.archivebox-vnc.entrypoints=http - traefik.http.services.archivebox-vnc.loadbalancer.server.port=8080 pihole: image: pihole/pihole:latest ports: # access the admin HTTP interface on http://localhost:8090 - 8191:80 environment: - WEBPASSWORD=NormalPassword01 - DNSMASQ_LISTENING=all dns: - 127.0.0.1 - 1.1.1.1 networks: dns: ipv4_address:172.20.0.53 traefik-public: volumes: - /ceph/docker-data/archivebox/etc/pihole:/etc/pihole - /ceph/docker-data/archivebox/etc/dnsmasq:/etc/dnsmasq.d deploy: labels: - traefik.enable=true - traefik.swarm.network=traefik-public - traefik.http.routers.archivebox-pihole.rule=Host(`archivebox-pihole.internal`) - traefik.http.routers.archivebox-pihole.entrypoints=http - traefik.http.services.archivebox-pihole.loadbalancer.server.port=80 changedetection: image: ghcr.io/dgtlmoon/changedetection.io volumes: - /ceph/docker-data/archivebox/data-changedetection:/datastore networks: # network just used for pihole container to offer :53 dns resolving on fixed ip for archivebox container dns: ipam: driver: default config: - subnet: 172.20.0.0/20 traefik-public: external: true ``` ### ArchiveBox Configuration ```shell ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#2516
No description provided.