Installing calibre-web, in a Docker container, on a Ubuntu VM, running in TrueNAS
Damn, that was a long, drawn out title….
Basics:
-
As of this writing, I’m running TrueNAS 12.2
-
While I really like TrueNAS, TrueNAS/FreeNAS doesn't support Docker containers.
-
The TrueNAS team is working on TrueNAS SCALE, which is Linux-based, and support Docker containers, but it’s still in alpha.
-
Once TrueNAS SCALE has reached maturity, I'll most likely switch to it. Update: I switched to Ubuntu Server instead.
-
Right now, I have an Ubuntu Server virtual machine running on my TrueNAS server.
-
On that Ubuntu virtual machine, I'm running Docker.
-
In a Docker container, I run the calibre-web server.
-
I have my Calibre database, from the desktop app, mounted in a NFS share (/mnt/VD01/calibreDB/).
-
I have calibre-web configured to use the DB above.
-
For portability reasons, I have calibre-web's config/settings in the same NFS mount (/mnt/VD01/calibreDB/config/).
Steps:
-
Install Ubuntu server (I used 20.04).
-
Update/upgrade/reboot apt packages:
sudo apt-get update
sudo apt-get upgrade
If there are any “held back” packages, especially since this is a fresh install:
sudo apt-get --with-new-pkgs upgrade
-
Change timezone to my timezone (Ubuntu server 20.04 uses UTC by default):
sudo timedatectl set-timezone America/Denver
-
Install docker, docker compose, NFS common (to mount NFS shares), and basic networking tools (for usage/troubleshooting):
sudo apt-get install -y net-tools nfs-common docker-compose apt-transport-https ca-certificates curl gnupg-agent software-properties-common
-
Add calibre DB as a NFS mount (assuming your calibre DB is on 192.168.1.201):
sudo su
mkdir /mnt/calibreDB
echo "192.168.1.201:/mnt/VD01/calibreDB /mnt/calibreDB nfs rsize=32768,wsize=32768,timeo=14,intr" >> /etc/fstab
mount -a
ls -l /mnt/calibreDB
Note: You need to be root, not just using
sudo
, when running the echo command into /etc/fstab. -
Configure docker to be run by a non-root user:
sudo groupadd docker
sudo usermod -aG docker $USER
Log out, then log back in, so the new user permissions are applied.
-
Make sure everything docker-related works:
docker run hello-world
-
Create the docker compose yaml file for calibre-web:
--- version: "2.1" services: calibre-web: image: ghcr.io/linuxserver/calibre-web container_name: calibre-web environment: - PUID=1000 - PGID=1000 - TZ=America/Denver - DOCKER_MODS=linuxserver/calibre-web:calibre volumes: - /mnt/calibreDB/config:/config - /mnt/calibreDB:/books ports: - 8083:8083 restart: unless-stopped
-
Download/build/run docker image for calibre-web:
docker-compose -f ./calibre-web.yaml up -d
Post install
Wait a few minutes for the container to download/install the necessary packages, then connect to http://[host IP]:8083
If you want to view the logs on the container, especially while waiting for it to download/install packages:
docker logs calibre-web
To connect to the container:
docker exec-it calibre-web /bin/bash
References
Calibre https://calibre-ebook.com/
calibre-web https://github.com/janeczku/calibre-web
calibre-web Docker with Calibre layer https://github.com/linuxserver/docker-calibre-web/tree/calibre
TrueNAS https://www.truenas.com/
TrueNAS SCALE https://www.truenas.com/truenas-scale/