Skip to content

Run your own ebook library

A beginner's guide to self-hosting your books with calibre-zen and Docker, from an empty folder to reading on every device in the house.

By the end you have a private library that any browser in the house can open, with a reader built in. It takes about fifteen minutes, most of it waiting for a download.

  • Your books in any browser. Phones, tablets and computers can search, read and download them, with no app to install.
  • Plain files you own. The library is an ordinary calibre library, a folder of books and one metadata.db. calibre and calibre-zen on a desktop can open the same folder, so nothing locks you in.
  • A login. Only the people you choose can see and change your books.
  • A drop folder. Copy a book into it and it moves into your library a few seconds later.
  • A computer that stays on. A NAS, a Raspberry Pi 4 or 5, a small PC or an old laptop all work. Intel and ARM are both fine.
  • Docker with Compose. Most NAS systems have it in their app store. On Linux, the official install script from Docker sets up both.
  • Some ebooks. EPUB, PDF, MOBI, AZW3 and CBZ all work. Books with DRM do not open in any reader outside the store that sold them.

The download is about 420 MB, because the image carries all of calibre.

  1. Make a folder for it and step inside. Everything lives here, your books included.

    Terminal window
    mkdir calibre-zen && cd calibre-zen
  2. Download the ready Compose file.

    Terminal window
    curl -fsSLO https://raw.githubusercontent.com/purplecandy/calibre-zen/zen/packaging/docker/compose.yaml
  3. Pick a password and save it next to the Compose file. Use your own in place of the example.

    Terminal window
    echo 'CALIBRE_ZEN_PASSWORD=a-long-password-of-your-own' > .env
  4. Check who should own the books. Run id and look at the numbers after uid= and gid=. If they are not both 1000, change PUID and PGID in compose.yaml to match.

  5. Start it.

    Terminal window
    docker compose up -d

    The first start makes three folders next to the Compose file: library for your books, config for settings and add-books for new books.

Go to http://your-server:8080 in a browser and sign in as reader with your password. Use the server’s address in place of your-server. On Linux, hostname -I shows it.

The library is empty for now. That comes next.

  • Drop them in. Copy books into the add-books folder. Each one moves into your library a few seconds later.
  • Upload them. Once you are signed in, the web app has a button to add books from the device you are on.
  • Bring a calibre library you already have. Stop the container, then put your library in the library folder, or point ./library in compose.yaml at it. It is the folder that holds metadata.db. Nothing in it is moved or renamed.
  • Phones and tablets. Open the address and read in the browser. Adding it to your home screen makes it feel like an app.
  • Reading apps. Apps that speak OPDS, such as KOReader, can browse the library at http://your-server:8080/opds with the same username and password. A few apps only manage the simpler basic sign in, which the reverse proxy section below turns on.
  • E-readers with a browser. Kobo and Kindle browsers can open the address and download books in a format the device reads.

Leave this for later if you only read at home.

  • The easy way is a private network such as Tailscale or WireGuard. Your phone joins it, and the library stays off the open internet with no ports to open. Share your library over the internet walks through it with Tailscale.
  • The public way is a reverse proxy such as Caddy, Traefik or nginx, which adds HTTPS. Basic sign in suits it best, and one line under the service in compose.yaml turns it on. Set CALIBRE_ZEN_URL_PREFIX too if you serve it under a path like /books.
command: ['--auth-mode', 'basic']

Never open port 8080 to the internet without HTTPS in front of it. The password would travel in the clear.

  • Back up two folders. library holds every book and its details, and config holds your settings and users. Stop the container first, or copy them while nobody is adding books, so the database is not caught mid-change.
  • Update in one line. docker compose pull && docker compose up -d gets the newest release. Your books and settings stay where they are.
  • Add more people. docker exec -it calibre-zen zen-entrypoint --manage-users opens a menu to add, change or remove users.

docker compose logs -f shows what the server is doing, and the fixes below cover the usual reasons it stops.

  • It will not start and mentions the password. The .env file is missing, or is not in the same folder as compose.yaml.
  • It says it cannot write to the library. The user in PUID and PGID has to own the books. Run id again and match them.
  • It says another program has the library open. calibre is still running on that library somewhere. Close it and start the container again.

Every setting, from time zones to sharing a library with a group, is in the Docker guide on GitHub. Questions are welcome on Reddit or GitHub Issues.

Download calibre-zen

The list of downloads could not be loaded just now. Every release, with a file for Windows, macOS and Linux, is on GitHub.