Calibre Library - Docker NAS Setup
Tags: calibre, docker, nas, tutorial
Published: 2021-02-06 02:21:40

---
title: Calibre Library - Docker NAS Setup
published: true
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/cytomjwwuvys58b4gtrx.jpg
date: 2021-02-05 00:00:00 UTC
tags: calibre,docker,nas,tutorial
canonical_url: https://chrisotto.dev/calibre-library-docker-nas/
series: Synology NAS Setup
---

Image courteous of [Susan Yin at Unsplash](https://unsplash.com/@syinq).

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.

## [<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#prerequisites-)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](https://dev.to/chrisotto/synology-nas-ssh-to-find-user-info-396a)
  - 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

## [<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#create-folder-structure-)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`

## [<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#downloading-and-configuring-the-image-)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](https://fleet.linuxserver.io/) 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 |

## [<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#launch-the-container-)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`.

## [<svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>](#configuring-calibre-)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! 🍻