DEV Community

loading...
Cover image for Calibre Library - Docker NAS Setup

Calibre Library - Docker NAS Setup

chrisotto profile image Chris Otto Originally published at chrisotto.dev on ・6 min read

Image courteous of Susan Yin at Unsplash.

Calibre is a free ebook manager. It has been around for a while, has an e-book viewer, ability to share your library and a verbose plugin ecosystem. I have used Calibre for a few years on my desktop computer with great results and once I got a NAS I wanted to switch it over there. I’ll guide you how to setup the Calibre docker image, if you want to get it setup on a server or machine running linux you can follow the same steps just ignore the Synology NAS specific steps.

Prerequisites 📃

  • Download Docker from Package Center
    • In DSM head over to Package Center
    • Search for Docker
    • Install
  • Enable SSH for your NAS
    • If you don’t have SSH enabled follow this guide
    • Make sure to make note of your user ID and group ID for admin as we will need that later when setting up the container

Create Folder Structure 📂

In DSM, open up the File Station:

  • Installing docker creates a docker folder at the root of your volume
  • Create a new folder in the docker folder for Calibre
    • I always create the folder based on the name of the image/container I’m setting up, in this case calibre
  • Inside the calibre folder create a plugins and upload directory
  • If you don’t have an ebook folder in your NAS create one where ever you want
    • I have mine set up in homes/%MY USER%/ebooks

Downloading and Configuring the Image 🚢

Open on Docker on your NAS. In the Registry tab search for calibre. The image that we’re looking for is the official Pi-hole image, linuxserver/calibre, this one of the many Docker images offered by the linuxserver folks. Select the image and select Download or just double click it. Once the image has finished downloading, head on over to the Images tab and click Launch or again double click it.

Now you should be in the Create Container pop-over:

  • Enter the container name, calibre
  • Click Advanced Settings

In the Advanced Settings main tab:

  • Enable Enable auto-restart

In the Volume tab, we’re going to add a few folders to be used by our docker container. One for where your ebooks collection and the other for the Calibre config. The plugin ecosystem is strong within Calibre, I would suggest creating a volume for any plugins you may want to add. One final volume you may want to consider is an upload volume. As you want to add ebooks to your library you’ll need a place to stage them before importing them into Calibre. Check out the examples below you’ll want to match the Mount Paths for the first two, the others can be whatever works for what you want to set up with Calibre:

File/Folder Mount Path
homes/%USER%/ebooks /Calibre_Library
docker/calibre/calibre /config
docker/calibre/upload /upload
docker/calibre/plugins /plugins

In the Port Settings tab configure what local ports you want to use for the Calibre. You'll want to make sure you set them to ports that aren't being used by any other containers or applications. I have provided my ports below:

Local Port Container Port Type
32770 3389 TCP
24880 8080 TCP
24881 8081 TCP

Finally, in the Environment tab we need to set the PUID and PGID variables to IDs that you looked up earlier in the prerequisites

Variable Value
PUID %USER_ID%
PGID %GROUP_ID

Launch the Container 🚀

With everything configured you’re now ready to click Apply and launch your new Pi-hole container. Once the container has started, head on over to http://[YOUR NAS IP ADDRESS]:[], so for me this is http://192.168.1.74:24880.

Configuring Calibre 📚

The Calibre wizard should be present and it will ask you where the database should be. The volume we set up for this is Calibre_Library the default is config config/Calibre_Library change it to be what was set up for the volume.

Now to set up the coolest part about Calibre, setting up sharing over the internet. With this enabled, you can navigate to the URL your Calibre library from your devices and download ebooks. Settings:

  • Select Preferences
  • Select Sharing over the net
  • Select User Accounts
    • Create a new user
  • Make sure the port to listen to connections to is 8081
    • This is the internal docker port it shouldn’t be the port you set to route to 8081 earlier
  • Check Require username and password to access the content server
  • Check Run server automatically when calibre starts
  • Select Apply

Now on your phone or tablet navigate to your NAS’s IP address and the port that forwards to 8081, in my example this is: http://192.168.1.74:24881. You should see your library load up and you’ll be able to download them on your various devices.

Happy reading! Cheers! 🍻

Discussion (2)

Collapse
itsasine profile image
ItsASine (Kayla)

Does the calibre viewer functionality work with this or is it mainly to centrally organize books?

I'm been looking for a way to use calibre on a NAS but it seems like most solutions on Reddit just have ebooks in a file system, not using all the fun of calibre itself. I ended up just keeping my calibre folder backed up to GDrive 🤷

calibre itself seems super against the idea of a NAS or centralized ebooks at all. I just want my computer books on my phone without losing my spot 😭

Collapse
chrisotto profile image
Chris Otto Author

I keep them on my NAS for the library management and storage but then when I want to read them I send them to my Kindle e-mail address for my paperwhite or Kindle app on my phone. It's a really nice workflow because then kindle keeps track of progress and can integrate with reading status on Goodreads. May be worth exploring if you are losing your spot with the Calibre viewer.

Forem Open with the Forem app