dankhostself-host anything

ArchiveBox with Docker Compose

Open source self-hosted web archiving. Takes URLs/browser history/bookmarks/Pocket/Pinboard/etc., saves HTML, JS, PDFs, media, and more... In the project's words: ArchiveBox on GitHub (repository description) checked 2026-10-03

Runs on: amd64, arm64 from each image's registry manifest, checked 2026-10-03; a CPU counts only if every image has a build for it. Image by image

Add ArchiveBox to the builder to use your own domain, get its passwords generated in your browser, and combine it with other apps in one file.

What ArchiveBox needs

Only figures ArchiveBox's own documentation publishes, each linked to the page it is on. Where the project gives no number, this page does not invent one.

ResourceMinimumRecommended
RAMThe project publishes no figure
CPUThe project publishes no figure
DiskThe project publishes no figure
No minimum is published, only how the archive grows: "ArchiveBox can use anywhere from ~1gb per 1000 Snapshots, to ~50gb per 1000 Snapshots", mostly depending on whether video and audio are saved (YTDLP_ENABLED, YTDLP_MAX_SIZE). Source: ArchiveBox README (CPUs amd64 and arm64; ~1 GB to ~50 GB per 1000 snapshots) checked 2026-10-03

On top of this, Caddy (the reverse proxy in the file) is a single small container.

Which hardware ArchiveBox has images for

Read from each image's manifest list in its registry (anonymous, read-only) when this page was built. An app counts for a CPU only if every one of its images lists it.

  • x86-64 PC or NAS (linux/amd64): every image has a build.
  • Raspberry Pi 4/5, 64-bit OS (linux/arm64): every image has a build.
  • Raspberry Pi 3 or Zero 2 W, 32-bit OS (linux/arm/v7): no image for archivebox. No image for this hardware; the builder leaves the app out.
ServiceImagePlatforms in the manifestDigestRegistryChecked
archiveboxarchivebox/archivebox:devamd64, arm64sha256:87573a932110989e0d9e1e0473eed7637879cfd62246288d8c7385644c446b83registry-1.docker.io2026-10-03

A manifest says an image exists for a CPU, not how well ArchiveBox runs on it: a build for arm64 or arm/v7 can still be too slow or need more memory than the board has. The RAM and disk ArchiveBox publishes are in the table above and, for a whole set of apps against a Raspberry Pi, on Will it run on my machine?. A tag like latest can move to a new digest after the date checked.

docker-compose.yml

This is exactly what the builder writes for ArchiveBox alone on example.org: the official definition with its published ports removed and Caddy added in front. Every ${VARIABLE} is defined in the .env below.

# docker-compose.yml built at dankhost.com for: ArchiveBox
# Each app block is its official compose definition. Only the names were prefixed with
# the app slug (services, containers, volumes, bind folders, .env variables) so any set of
# apps can share one file; other differences are listed under "Changed:" in each block.
# Only Caddy publishes ports. Secrets live in .env next to this file.

services:
  # ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ----
  # Source: https://caddyserver.com/docs/running (checked 2026-09-23)
  # Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23)
  # Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly.
  caddy:
    image: "caddy:2"
    container_name: "caddy"
    restart: "unless-stopped"
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - "./caddy:/etc/caddy"
      - "caddy-data:/data"
      - "caddy-config:/config"
    networks:
      proxy:
        ipv4_address: "172.30.0.2"

  # ---- ArchiveBox (archive.example.org) ----
  # Source: https://github.com/ArchiveBox/ArchiveBox/blob/dev/docker-compose.yml (checked 2026-10-03)
  # Source: https://github.com/ArchiveBox/ArchiveBox/wiki/Docker (checked 2026-10-03)
  # Source: https://github.com/ArchiveBox/ArchiveBox/wiki/Configuration (checked 2026-10-03)
  # Source: https://github.com/ArchiveBox/ArchiveBox/wiki/Upgrading (checked 2026-10-03)
  # Changed: Removed the documented '${ARCHIVEBOX_PORT:-5797}:5797' port; Caddy reaches archivebox:5797 on the proxy network, the upstream the Docker page names for single-domain mode. The image line ${ARCHIVEBOX_IMAGE:-archivebox/archivebox:dev} is written out as its default.
  #          BASE_URL and SERVER_SECURITY_MODE, which the file passes through empty for the first-run wizard to fill, are set: BASE_URL is https://archive.example.org and the mode is safe-onedomain-nojsreplay, the Configuration page's mode for one host without wildcard DNS. With both set, the Docker page says, the server skips the web-access wizard.
  #          The file's commented-out ADMIN_USERNAME and ADMIN_PASSWORD lines ("creates an admin user on first run") are switched on, with the password generated in .env, so the admin account exists before anyone else can open /admin/.
  #          The optional PUID and PGID lines, which pass your shell's values through, are left out: the image then uses the owner of ./data, as the file's comments say.
  archivebox:
    image: "archivebox/archivebox:dev"
    container_name: "archivebox"
    restart: "unless-stopped"
    volumes:
      - "./archivebox/data:/data"
      - "archivebox-tmp:/tmp/archivebox"
    pids_limit: 2048
    environment:
      ADMIN_USERNAME: "admin"
      ADMIN_PASSWORD: "${ARCHIVEBOX_ADMIN_PASSWORD}"
      BASE_URL: "https://archive.example.org"
      SERVER_SECURITY_MODE: "safe-onedomain-nojsreplay"
      PUBLIC_ADD_VIEW: "False"
    shm_size: "1gb"
    networks:
      proxy: {}

networks:
  # Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact.
  # If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's
  # ipv4_address and in every trusted-proxy value to a free 172.x.0 range.
  proxy:
    ipam:
      config:
        - subnet: "172.30.0.0/24"
          ip_range: "172.30.0.128/25"
          gateway: "172.30.0.1"

volumes:
  caddy-data:
  caddy-config:
  archivebox-tmp:

Caddyfile save as caddy/Caddyfile

Caddy gets and renews the HTTPS certificate for archive.example.org by itself once the DNS record points at your server and ports 80 and 443 reach it.

# Caddyfile built at dankhost.com. Save it as ./caddy/Caddyfile next to docker-compose.yml.
# Caddy gets and renews a Let's Encrypt certificate for each name below by itself,
# once the DNS records point at this server and ports 80 and 443 reach it.

# ArchiveBox
archive.example.org {
	reverse_proxy archivebox:5797
}

Already running nginx, Nginx Proxy Manager, Caddy or Traefik? The reverse-proxy settings ArchiveBox needs, for all four, each cited to ArchiveBox's own docs.

.env

The secret is left blank here on purpose: a password printed on a public page is the same for everyone who copies it. The builder fills it with random letters and digits made in your browser.

# .env for ArchiveBox, from dankhost.com/app/archivebox/. Fill the blank secret before starting.
# Keep this file private (chmod 600).

# ArchiveBox
# 32 random letters and digits: the builder fills this in your browser
ARCHIVEBOX_ADMIN_PASSWORD=

Changes from the official file

Besides prefixing every service, container, volume, folder and variable with archivebox (so any set of apps can share one file), these are all the differences from what the project documents:

  • Removed the documented '${ARCHIVEBOX_PORT:-5797}:5797' port; Caddy reaches archivebox:5797 on the proxy network, the upstream the Docker page names for single-domain mode. The image line ${ARCHIVEBOX_IMAGE:-archivebox/archivebox:dev} is written out as its default.
  • BASE_URL and SERVER_SECURITY_MODE, which the file passes through empty for the first-run wizard to fill, are set: BASE_URL is https://archive.example.org and the mode is safe-onedomain-nojsreplay, the Configuration page's mode for one host without wildcard DNS. With both set, the Docker page says, the server skips the web-access wizard.
  • The file's commented-out ADMIN_USERNAME and ADMIN_PASSWORD lines ("creates an admin user on first run") are switched on, with the password generated in .env, so the admin account exists before anyone else can open /admin/.
  • The optional PUID and PGID lines, which pass your shell's values through, are left out: the image then uses the owner of ./data, as the file's comments say.

Notes for ArchiveBox behind the proxy

  • The image tag is dev, the only one the compose file and the Docker page use; the page itself calls :dev "unstable alpha builds (breaks often, only for developers and willing beta testers)". Read the release notes before each update and keep the backup below current.
  • Log in at https://archive.example.org/admin/ as admin with ARCHIVEBOX_ADMIN_PASSWORD from .env. Add pages there, or from the server: docker compose exec archivebox archivebox add followed by the page's address in quotes.
  • safe-onedomain-nojsreplay serves archived pages without running their JavaScript, so pages that need it may look incomplete. Full replay needs safe-subdomains-fullreplay, which takes wildcard DNS and a wildcard certificate for *.archive.example.org; the Docker page says never to request single certificates for the snap-* names.
  • PUBLIC_ADD_VIEW=False keeps the add form closed to visitors who are not logged in.

How to run it

  1. At your DNS provider, add an A record named archive on your domain pointing at the server's public IP address, and forward TCP 80, TCP 443 and UDP 443 to it.
  2. Save the three files in one folder: docker-compose.yml and .env side by side, the Caddyfile at ./caddy/Caddyfile. Replace example.org with your domain in the Caddyfile, the compose file and the .env, or let the builder do it.
  3. Fill the blank ARCHIVEBOX_ADMIN_PASSWORD in .env. The builder generates it; on the server, tr -dc A-Za-z0-9 </dev/urandom | head -c 32 prints 32 random letters and digits. Then chmod 600 .env.
  4. Start it:
    docker compose up -d
    docker compose logs -f caddy   # watch the certificate arrive
  5. Open the new address (archive. plus your domain) in a browser and follow the notes above.

Back it up

ArchiveBox's upgrade page says what to back up: stop the server, then "back up the entire collection data directory", which holds index.sqlite3, ArchiveBox.conf and every archived file. A database-only backup does not include the archived outputs.

Below is the BACKUP.md the builder writes next to the compose file above: which of its folders and volumes hold data, what to copy with which container stopped, and a restore check. Pick more apps in the builder and it covers them all in one file.

# BACKUP.md built at dankhost.com for: ArchiveBox

What to copy from the docker-compose.yml built with this file, the database dump each project documents (rewritten for the service names in that file), what to copy with which container stopped, and how to check the result. Run every command in the folder that holds docker-compose.yml.

The folders are owned by the containers' users: put sudo in front of tar if it says "Permission denied". Named volumes live under /var/lib/docker/volumes, not next to the compose file, so they are copied through a throwaway ubuntu container (Docker's documented --volumes-from method). tar makes a full copy each run; for large folders an incremental tool (restic, borg, rsync) saves time and space.

Never run "docker compose down -v" on this file: it deletes the named volumes of every app in it.

## Before you start

    BACKUP=/mnt/backup/selfhost   # change this: a disk or machine other than this server's system disk
    mkdir -p "$BACKUP"

## Every time: the three stack files

    tar czf "$BACKUP/stack-files.tar.gz" docker-compose.yml .env caddy

.env holds the database passwords and secret keys the apps were set up with; keep this archive as private as the data.

## Caddy (the reverse proxy)

Caddy's docs: 'The data directory must not be treated as a cache.' It holds the TLS certificates and their private keys; without it Caddy has to ask Let's Encrypt for every certificate again.

- caddy-data (named volume, /data in caddy)
  BACK UP: TLS certificates, private keys, OCSP staples.
- caddy-config (named volume, /config in caddy)
  SKIP: the last active configuration, kept for 'caddy run --resume', which this setup does not use: it starts from the Caddyfile.
- ./caddy (/etc/caddy in caddy)
  IN stack-files.tar.gz: the Caddyfile, copied with the stack files above.

Copy (Caddy keeps serving while you copy):

    docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu tar cvf /backup/caddy-data.tar /data

Restore check:

    tar tf "$BACKUP/caddy-data.tar" > /dev/null && echo OK
    docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu bash -c "cd /data && tar xvf /backup/caddy-data.tar --strip 1"

Sources:
- Caddy docs: Conventions, Data directory: https://caddyserver.com/docs/conventions#data-directory (checked 2026-09-24)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-24)

## ArchiveBox

ArchiveBox's upgrade page says what to back up: stop the server, then "back up the entire collection data directory", which holds index.sqlite3, ArchiveBox.conf and every archived file. A database-only backup does not include the archived outputs.

What this compose mounts:
- ./archivebox/data (/data in archivebox)
  BACK UP: the whole collection: index.sqlite3 (the SQLite index), ArchiveBox.conf and the archive/ folders with every saved page.
- archivebox-tmp (named volume, /tmp/archivebox in archivebox)
  SKIP: scratch space the server's supervisor shares with one-off docker compose run commands.

1. Stop archivebox. The upgrade page: stop any running server and workers first, so the SQLite index and the archive folders match.

    docker compose stop archivebox

2. Copy while archivebox is stopped:

    tar czf "$BACKUP/archivebox-data.tar.gz" ./archivebox/data

3. Start it again:

    docker compose start archivebox

Restore check:

    tar tzf "$BACKUP/archivebox-data.tar.gz" > /dev/null && echo OK

Put a copy back (with archivebox stopped):

    tar xzf "$BACKUP/archivebox-data.tar.gz"   # recreates ./archivebox/data; move the old folder aside first

Stop it, put ./archivebox/data back, start it. ArchiveBox reads the collection from that folder.

Sources:
- ArchiveBox wiki: Upgrading Versions (Upgrading with Docker Compose, back up first): https://github.com/ArchiveBox/ArchiveBox/wiki/Upgrading (checked 2026-10-03)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-10-03)

Update it

What docker compose pull does depends only on how each image line in the compose file above is tagged. For ArchiveBox as this page writes it:

ServiceImageHow it is pinnedWhat docker compose pull does
caddycaddy:2Major version only (tag 2)Takes the newest image tagged 2: minor and patch releases of 2, never 3. A new major version needs a tag edit.
archiveboxarchivebox/archivebox:devNot pinned: moving tag devMoves to the newest image published as dev, which can be a new major version.

What ArchiveBox's docs say about updating

ArchiveBox's upgrade page, "Upgrading with Docker Compose": stop the containers, pull, run init and the migrations, start again:

docker compose down
docker compose pull
docker compose run --rm archivebox init
docker compose run --rm archivebox update --migrate-only
docker compose up -d
  • The service keeps its name, archivebox, in this file, so the commands work as written. When other apps share the file, use docker compose stop archivebox instead of down: down stops all of them.
  • The page also asks you to read the release notes of every version you skip and to upgrade one major version at a time.

Source: ArchiveBox wiki: Upgrading Versions (Upgrading with Docker Compose, back up first) checked 2026-10-03

The steps

  1. Back up first, as in Back it up above. An update can migrate ArchiveBox's data on its first start; the copy is the way back.
  2. Download the new images. Running containers are not touched yet:
    docker compose pull
  3. Recreate the containers whose image changed. Volumes and bind-mounted folders stay as they are:
    docker compose up -d
  4. Watch ArchiveBox start (Ctrl+C stops following the log, not the app):
    docker compose logs -f archivebox
  5. Optional: remove the old images the pull left without a tag. This covers every stack on the machine, not only this one:
    docker image prune

Docker's reference for these commands: Docker docs: docker compose pull checked 2026-09-30; Docker docs: docker compose up (recreates changed containers, keeps volumes) checked 2026-09-30; Docker docs: docker image prune checked 2026-09-30

Sources

Every page below was fetched on the date shown.

Add ArchiveBox to the builder All eighty apps