Self-Host Calibre with Docker and Traefik Reverse Proxy

Set up a self-hosted e-book manager with Calibre and Calibre-Web as GUI behind Traefik reverse proxy. Manage your e-books privately on your own server.

Published on
Self-Host Calibre with Docker and Traefik Reverse Proxy hero image

Today (April 23) is World Book Day. The day of honor for e-books is not today, but this post is still about setting up your e-book manager. In this guide, I will show you how to do this on a server with Traefik as a reverse proxy. The prerequisite is the setup of Traefik as already described here. We use the program Calibre (as a server) and Calibre-Web (as a web GUI) as an e-book manager.

If there is interest in an equivalent description for a Synology server, this may follow later.

Once the connection (e.g. ssh username@ip-address) to the server is established, we need a folder where the books and data from Calibre will be stored.

Terminalbash
cd ~/docker
mkdir appdata/calibre

And the Docker Compose file can already be created.

Terminalbash
nano docker-compose-calibre.yml
yaml
version: "3.7"

### NETWORKS ###
networks:
    web:
        external:
            name: web
    default:
        driver: bridge

### SERVICEs ###
services:
    calibre-server:
        container_name: calibre-server
        image: linuxserver/calibre
        restart: unless-stopped
        networks:
            - web
        security_opt:
            - no-new-privileges:true
        volumes:
            - $DOCKERDIR/appdata/calibre:/config
        environment:
            - PUID=$PUID
            - PGID=$PGID
            - TZ=$TZ
            - UMASK=022
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.calibre-rtr.entrypoints=https"
            - "traefik.http.routers.calibre-rtr.rule=Host(`calibre.$DOMAINNAME`)"
            - "traefik.http.routers.calibre-rtr.tls=true"
            - "traefik.http.routers.calibre-rtr.service=calibre-svc"
            - "traefik.http.services.calibre-svc.loadbalancer.server.port=8080"
            - "traefik.http.routers.calibre-rtr.middlewares=chain-oauth@file"

We use the image from LinuxServer.io. The setup is now complete.

Terminalbash
docker-compose -f docker-compose-calibre.yml up -d

After loading the container, we call up the page calibre.somedomain.de.

Calibre Setup Wizard

I leave the name of my folder at “Calibre-Bibliothek”. You can then access your library.

Calibre library

Next, we stop the container again and look at where the Calibre library is.

Terminalbash
docker-compose -f docker-compose-calibre.yml down
cd appdata/calibre
ls -Al

Calibre directory

We see that the Calibre library has been created. We add Calibre-Web to the docker-compose file.

Terminalbash
cd ~/docker
mkdir appdata/calibreweb
nano docker-compose-calibre.yml
yaml
version: "3.7"

### NETWORKS ###
networks:
    web:
        external:
            name: web
    default:
        driver: bridge

### SERVICEs ###
services:
    calibre-server:
        container_name: calibre-server
        image: linuxserver/calibre
        restart: unless-stopped
        networks:
            - web
        security_opt:
            - no-new-privileges:true
        volumes:
            - $DOCKERDIR/appdata/calibre:/config
        environment:
            - PUID=$PUID
            - PGID=$PGID
            - TZ=$TZ
            - UMASK=022
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.calibre-rtr.entrypoints=https"
            - "traefik.http.routers.calibre-rtr.rule=Host(`calibre.$DOMAINNAME`)"
            - "traefik.http.routers.calibre-rtr.tls=true"
            - "traefik.http.routers.calibre-rtr.service=calibre-svc"
            - "traefik.http.services.calibre-svc.loadbalancer.server.port=8080"
            - "traefik.http.routers.calibre-rtr.middlewares=chain-oauth@file"

    calibre-web:
        container_name: calibre-web
        image: linuxserver/calibre-web
        restart: unless-stopped
        networks:
            - web
        security_opt:
            - no-new-privileges:true
        volumes:
            - $DOCKERDIR/appdata/calibreweb:/config
            - $DOCKERDIR/appdata/calibre/Calibre-Bibliothek:/books
        environment:
            - PUID=$PUID
            - PGID=$PGID
            - TZ=$TZ
            - UMASK=022
            - DOCKER_MODS=linuxserver/calibre-web:calibre
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.calibreweb-rtr.entrypoints=https"
            - "traefik.http.routers.calibreweb-rtr.rule=Host(`books.$DOMAINNAME`)"
            - "traefik.http.routers.calibreweb-rtr.tls=true"
            - "traefik.http.routers.calibreweb-rtr.service=calibreweb-svc"
            - "traefik.http.services.calibreweb-svc.loadbalancer.server.port=8083"
            - "traefik.http.routers.calibreweb-rtr.middlewares=chain-oauth@file"

Then restart again.

Terminalbash
docker-compose -f docker-compose-calibre up -d

Calibre-Web should now be available under “books.einedomain.de”.

Calibre Web Configuration

We log in with the preconfigured user data, username: admin and password: admin123. In the settings, we go to “Edit Basic Configuration”.

Admin area

The upload can be activated there.

Upload enabled

Now, it is possible to upload new books.

Calibre Web Dashboard

The setup is ready. Have fun reading and managing your e‑books 📖