Public | Automated Build

Last pushed: a month ago
Short Description
Docker image for Calibre Web, based on docker image of Alpine
Full Description

Calibre Web




Calibre Web - Manage your Calibre e-book collection

Calibre Web is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.

Calibre Web comes with the following features:

  • Bootstrap 3 HTML5 interface
  • full graphical setup
  • User management
  • Admin interface
  • User Interface in english, french, german, polish, simplified chinese, spanish
  • OPDS feed for eBook reader apps
  • Filter and search by titles, authors, tags, series and language
  • Create custom book collection (shelves)
  • Support for editing eBook metadata
  • Support for converting eBooks from EPUB to Kindle format (mobi/azw)
  • Restrict eBook download to logged-in users
  • Support for public user registration
  • Send eBooks to Kindle devices with the click of a button
  • Support for reading eBooks directly in the browser (.txt, .epub, .pdf)
  • Upload new books in PDF, epub, fb2 format
  • Support for Calibre custom columns
  • Fine grained per-user permissions
  • Self update capability

If you want to know more you can head over to the Calibre Web project site: https://github.com/janeczku/calibre-web.

And if you are interested in the original Calibre ebook management tool then look at the project site: https://calibre-ebook.com/.

Updates

2017-09-10 - v1.1.8

For previous changes see at full changelog.

Features

  • running Calibre Web under its own user (not root)
  • changing of the UID and GID for the Calibre Web user
  • no usage of NGINX inside the container, only the Calibre Web application is served as single application without any supervisor
  • Google Drive integration is included
  • creation of gdrive.db symlink at /books/gdrive.db for external access like backup possibility
  • creation of app.db symlink at /books/app.db for external access like backup possibility

Hints & Tips

  • if you need SSL support similiar to the original Docker Container janeczku/calibre-web then use an additional NGINX or Apache HTTP Server as Reverse-Proxy, e.g see jwilder/nginx-proxy
  • if you don't specify PGID and PUID values the default PGID and PUID of the image are used,
    and if they are used then the mapped host volume/directory which is alligned to /books must have read-write-execute permission for others , otherwise the configuration of Calibre-Web can't be finished :-|
  • for Synology Users - don't map a top-level volume directory from the NAS as /books volume, e.g. /volume1/books because it results into problems with directory permissons. Create instead a subdirectory calibre at /volume1/books and map then /volume1/books/calibre as volume for /books

Configuration at first launch

  1. Point your browser to http://hostname:<HTTP PORT> e.g. http://hostname:8083
  2. Set Location of your Calibre books folder to the path of the folder where you mounted your Calibre folder in the container, which is by default \books.
    So enter at the field Location of Calibre database the mapped volume \books.
  3. Hit Submit then Login.

Default admin login:

  • Username: admin
  • Password: admin123

After successful login change the default password and set the email adress.

To access the OPDS catalog feed, point your Ebook Reader to http://hostname:<HTTP PORT>/opds

Usage

Create the container:

docker create --name=calibre-web --restart=always \
-v <your Calibre books folder>:/books \
[-e APP_REPO=https://github.com/janeczku/calibre-web.git \]
[-e APP_BRANCH=master \]
[-e SET_CONTAINER_TIMEZONE=true \]
[-e CONTAINER_TIMEZONE=<container timezone value> \]
[-e PGID=<group ID (gid)> -e PUID=<user ID (uid)> \]
-p <HTTP PORT>:8083 \
technosoft2000/calibre-web

Example:

docker create --name=calibre-web --restart=always \
-v /volume1/books/calibre:/books \
-v /etc/localtime:/etc/localtime:ro \
-e PGID=65539 -e PUID=1029 \
-p 8083:8083 \
technosoft2000/calibre-web

or

docker create --name=calibre-web --restart=always \
-v /volume1/books/calibre:/books \
-e SET_CONTAINER_TIMEZONE=true \
-e CONTAINER_TIMEZONE=Europe/Vienna \
-e PGID=65539 -e PUID=1029 \
-p 8083:8083 \
technosoft2000/calibre-web

Start the container:

docker start calibre-web

Parameters

Introduction

The parameters are split into two parts which are separated via colon.
The left side describes the host and the right side the container.
For example a port definition looks like this -p external:internal and defines the port mapping from internal (the container) to external (the host).
So -p 8080:80 would expose port 80 from inside the container to be accessible from the host's IP on port 8080.
Accessing http://'host':8080 (e.g. http://192.168.0.10:8080) would then show you what's running INSIDE the container on port 80.

Details

  • -p 8083 - http port for the web user interface
  • -v /books - local path which contains the Calibre books and the necessary metadata.db which holds all collected meta-information of the books
  • -v /etc/localhost - for timesync - optional
  • -e APP_REPO - set it to the Calibre Web GitHub repository; by default it uses https://github.com/janeczku/calibre-web.git - optional
  • -e APP_BRANCH - set which Calibre Web GitHub repository branch you want to use, master (default branch) - optional
  • -e SET_CONTAINER_TIMEZONE - set it to true if the specified CONTAINER_TIMEZONE should be used - optional
  • -e CONTAINER_TIMEZONE - container timezone as found under the directory /usr/share/zoneinfo/ - optional
  • -e PGID for GroupID - see below for explanation - optional
  • -e PUID for UserID - see below for explanation - optional

Container Timezone

In the case of the Synology NAS it is not possible to map /etc/localtime for timesync, and for this and similar case
set SET_CONTAINER_TIMEZONE to true and specify with CONTAINER_TIMEZONE which timezone should be used.
The possible container timezones can be found under the directory /usr/share/zoneinfo/.

Examples:

  • UTC - this is the default value if no value is set
  • Europe/Berlin
  • Europe/Vienna
  • America/New_York
  • ...

Don't use the value localtime because it results into: failed to access '/etc/localtime': Too many levels of symbolic links

User / Group Identifiers

Sometimes when using data volumes (-v flags) permissions issues can arise between the host OS and the container. We avoid this issue by allowing you to specify the user PUID and group PGID. Ensure the data volume directory on the host is owned by the same user you specify and it will "just work" ™.

In this instance PUID=1001 and PGID=1001. To find yours use id user as below:

  $ id <dockeruser>
    uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)

Additional

Shell access whilst the container is running: docker exec -it calibre-web /bin/bash

Upgrade to the latest version of Calibre Web: docker restart calibre-web

To monitor the logs of the container in realtime: docker logs -f calibre-web

To monitor the logs of Calibre Web: docker exec -it calibre-web tail -f /calibre-web/app/calibre-web.log

Show used base image version number of Calibre Web: docker inspect -f '{{ index .Config.Labels "image.base.version" }}' calibre-web

Show used image version number of Calibre Web: docker inspect -f '{{ index .Config.Labels "image.version" }}' calibre-web


For Synology NAS users

Login into the DSM Web Management

  • Open the Control Panel
  • Control Panel > Privilege > Group and create a new one with the name 'docker'
  • add the permissions for the directories 'downloads', 'video' and so on
  • disallow the permissons to use the applications
  • Control Panel > Privilege > User and create a new on with name 'docker' and assign this user to the group 'docker'

Connect with SSH to your NAS

  • after sucessful connection change to the root account via

    sudo -i
    

    or

    sudo su -
    

    for the password use the same one which was used for the SSH authentication.

  • create a 'docker' directory on your volume (if such doesn't exist)

    mkdir -p /volume1/docker/
    chown root:root /volume1/docker/
    
  • get your Docker User ID and Group ID of your previously created user and group

    id docker
    uid=1029(docker) gid=100(users) groups=100(users),65539(docker)
    
  • get the Docker image

    docker pull technosoft2000/calibre-web
    
  • create a Docker container (take care regarding the user ID and group ID, change timezone and port as needed)

    docker create --name=calibre-web --restart=always \
    -v /volume1/books/calibre:/books \
    -e SET_CONTAINER_TIMEZONE=true \
    -e CONTAINER_TIMEZONE=Europe/Vienna \
    -e PGID=65539 -e PUID=1029 \
    -p 8083:8083 \
    technosoft2000/calibre-web
    
  • check if the Docker container was created successfully

    docker ps -a
    CONTAINER ID        IMAGE                           COMMAND                CREATED             STATUS              PORTS               NAMES
    40cc1bfaf7be        technosoft2000/calibre-web      "/bin/bash -c /init/s" 8 seconds ago       Created
    
  • start the Docker container

    docker start calibre-web
    
  • analyze the log (stop it with CTRL+C)

    docker logs -f calibre-web
          ,----,                                   
        ,/   .`|                                   
      ,`   .'  : .--.--.        ,----,        ,-.  
    ;    ;     //  /    '.    .'   .' \   ,--/ /|  
    .'___,/    ,'|  :  /`. /  ,----,'    |,--. :/ |  
    |    :     | ;  |  |--`   |    :  .  ;:  : ' /   
    ;    |.';  ; |  :  ;_     ;    |.'  / |  '  /    
    `----'  |  |  \  \    `.  `----'/  ;  '  |  :    
      '   :  ;   `----.   \   /  ;  /   |  |   \   
      |   |  '   __ \  \  |  ;  /  /-,  '  : |. \  
      '   :  |  /  /`--'  / /  /  /.`|  |  | ' \ \ 
      ;   |.'  '--'.     /./__;      :  '  : |--'  
      '---'      `--'---' |   :    .'   ;  |,'     
                          ;   | .'      '--'       
                          `---'                    
        PRESENTS ANOTHER AWESOME DOCKER IMAGE     
        ~~~~~         Calibre Web       ~~~~~                                           
    [INFO] Docker image version: 1.1.8
    [INFO] Alpine Linux version: 3.6.0
    [WARNING] A group with id 100 exists already [in use by users] and will be modified.
    [WARNING] The group users will be renamed to calibre
    [INFO] Create user calibre with id 1029
    [INFO] Current active timezone is UTC
    Sun Sep 10 17:12:13 CEST 2017
    [INFO] Container timezone is changed to: Europe/Vienna
    [INFO] Change the ownership of /calibre-web (including subfolders) to calibre:calibre
    [INFO] Current git version is:
    git version 2.13.5
    [INFO] Checkout the latest Calibre-Web version ...
    [INFO] ... git clone -b master --single-branch https://github.com/janeczku/calibre-web.git /calibre-web/app -v
    Cloning into '/calibre-web/app'...
    POST git-upload-pack (189 bytes)
    [INFO] Autoupdate is active, try to pull the latest sources for Calibre-Web ...
    [INFO] ... current git status is
    On branch master
    Your branch is up-to-date with 'origin/master'.
    nothing to commit, working tree clean
    b6b5313f2d97210f325c6f973cd9ee710021043f
    [INFO] ... pulling sources
    Already up-to-date.
    [INFO] ... git status after update is
    On branch master
    Your branch is up-to-date with 'origin/master'.
    nothing to commit, working tree clean
    b6b5313f2d97210f325c6f973cd9ee710021043f
    [INFO] kindlegen (Amazon Kindle Generator) will be linked into /calibre-web/app/vendor
    [INFO] Creating the vendor directory: /calibre-web/app/vendor
    [INFO] Change the ownership of /calibre-web/app/vendor (including subfolders) to calibre:calibre
    > create kindlegen link /calibre-web/app/vendor/kindlegen assigned to source /calibre-web/kindlegen/kindlegen
    [INFO] Checking permissions of /books
    > Output is: 772 calibre 100 UNKNOWN 1026
    > Permissions: 772
    > Assigned group: calibre
    > Assigned group ID: 100
    > Assigned owner: UNKNOWN
    > Assigned owner ID: 1026
    > Using permissions for checks: 0772
    > Everyone has write access at /books
    [INFO] app.db and gdrive.db will be linked into /books
    > create app.db link /calibre-web/app/app.db assigned to source /books/app.db
    > create gdrive.db link /calibre-web/app/gdrive.db assigned to source /books/gdrive.db
    [INFO] Creating directory for temporary directories and files: /tmp
    [INFO] Change the ownership of /tmp (including subfolders) to calibre:calibre
    [INFO] Launching Calibre-Web ...
    
Docker Pull Command
Owner
technosoft2000

Comments (4)
caliban
2 months ago

hello technosoft2000! I was able to get your Docker image installed about a month ago; but I've just tried to reinstall it, and am hitting an error that makes me think there's a compatibility problem with @janeczku's source.

The shell command and output's copied below. What's happening in this NoneType for the self.config_calibre_dir assignment? Is config_calibre_dir something I need to configure at install time, or is it a problem "upstream?"

caliban@local:~$ docker run --name=calibre-web --restart=always -v /home/calibre/ebooks:/books -v /etc/localtime:/etc/localtime:ro -e PGID=1003 -e PUID=1003 -p 8083:8083 technosoft2000/calibre-web

Unable to find image 'technosoft2000/calibre-web:latest' locally
latest: Pulling from technosoft2000/calibre-web
2aecc7e1714b: Pull complete
3dab6bea1267: Pull complete
5726cc4cd8fb: Pull complete
38d29c9d393f: Pull complete
75fad1da58dd: Pull complete
be1c8b0850cf: Pull complete
f6cde5373e7a: Pull complete
d4e071ea1734: Pull complete
992c3a14eeb4: Pull complete
Digest: sha256:db92853ebc8720bcb106ce2b32147d9b28e0ab735e1139d2d468070f817ed080
Status: Downloaded newer image for technosoft2000/calibre-web:latest
        ,----,
      ,/   .`|
    ,`   .'  : .--.--.        ,----,        ,-.
  ;    ;     //  /    '.    .'   .' \   ,--/ /|
.'___,/    ,'|  :  /`. /  ,----,'    |,--. :/ |
|    :     | ;  |  |--`   |    :  .  ;:  : ' /
;    |.';  ; |  :  ;_     ;    |.'  / |  '  /
`----'  |  |  \  \    `.  `----'/  ;  '  |  :
    '   :  ;   `----.   \   /  ;  /   |  |   \
    |   |  '   __ \  \  |  ;  /  /-,  '  : |. \
    '   :  |  /  /`--'  / /  /  /.`|  |  | ' \ \
    ;   |.'  '--'.     /./__;      :  '  : |--'
    '---'      `--'---' |   :    .'   ;  |,'
                        ;   | .'      '--'
                        `---'

      PRESENTS ANOTHER AWESOME DOCKER IMAGE

      ~~~~~         Calibre Web       ~~~~~

[INFO] Docker image version: 1.1.7
[INFO] Alpine Linux version: 3.6.0
[INFO] Create group calibre with id 1003
[INFO] Create user calibre with id 1003
[INFO] Current active timezone is EDT
[INFO] Change the ownership of /calibre-web (including subfolders) to calibre:calibre
[INFO] Current git version is:
git version 2.13.5
[INFO] Checkout the latest Calibre-Web version ...
[INFO] ... git clone -b master --single-branch https://github.com/janeczku/calibre-web.git /calibre-web/app -v
Cloning into '/calibre-web/app'...
POST git-upload-pack (189 bytes)
[INFO] Autoupdate is active, try to pull the latest sources for Calibre-Web ...
[INFO] ... current git status is
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
a8b53ab38a46158dcd57bccb28805d377a547927
[INFO] ... pulling sources
Already up-to-date.
[INFO] ... git status after update is
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
a8b53ab38a46158dcd57bccb28805d377a547927
[INFO] kindlegen (Amazon Kindle Generator) will be linked into /calibre-web/app/vendor
> create kindlegen link /calibre-web/app/vendor/kindlegen assigned to source /calibre-web/kindlegen/kindlegen
ln: failed to create symbolic link '/calibre-web/app/vendor/kindlegen': No such file or directory
[INFO] Checking permissions of /books
> Output is: 775 calibre 1003 calibre 1003
> Permissions: 775
> Assigned group: calibre
> Assigned group ID: 1003
> Assigned owner: calibre
> Assigned owner ID: 1003
> Using permissions for checks: 0775
> Check if the group calibre has write access at /books
> The group calibre has write access at /books
[INFO] app.db and gdrive.db will be linked into /books
> create app.db link /calibre-web/app/app.db assigned to source /books/app.db
> create gdrive.db link /calibre-web/app/gdrive.db assigned to source /books/gdrive.db
[INFO] Creating directory for temporary directories and files: /tmp
[INFO] Change the ownership of /tmp (including subfolders) to calibre:calibre
[INFO] Launching Calibre-Web ...
Traceback (most recent call last):
  File "/calibre-web/app/cps.py", line 13, in <module>
    from cps import web
  File "/calibre-web/app/cps/web.py", line 30, in <module>
    import ub
  File "/calibre-web/app/cps/ub.py", line 593, in <module>
    config = Config()
  File "/calibre-web/app/cps/ub.py", line 300, in __init__
    self.loadSettings()
  File "/calibre-web/app/cps/ub.py", line 304, in loadSettings
    self.config_calibre_dir = data.config_calibre_dir
AttributeError: 'NoneType' object has no attribute 'config_calibre_dir'
technosoft2000
5 months ago

New version 2017-06-03 - v1.1.3 allows now usage of group id's PGID < 1000

technosoft2000
5 months ago

Hi saitoh183,

thanks for that info, I'll check this issue and give you feedback as soon as possible. Did you also tried to specify the PGID and PUID environment variable, because I think it is a problem that the generated internal user/group has no rights to create files in the mapped volume for /books.

I've created at github an issue => https://github.com/Technosoft2000/docker-calibre-web/issues/2

saitoh183
5 months ago

gives the error below when i start the container and map my volume.

[INFO] Docker image version: 1.1.2
[INFO] Create group calibre with id 15000
[INFO] Create user calibre with id 15000
[INFO] Current active timezone is EDT
[INFO] Change the ownership of /calibre-web (including subfolders) to calibre:calibre
[INFO] Current git version is:
git version 2.13.0
[INFO] Checkout the latest Calibre-Web version ...
[INFO] ... git clone -b master --single-branch https://github.com/janeczku/calibre-web.git /calibre-web/app -v
Cloning into '/calibre-web/app'...
POST git-upload-pack (189 bytes)
[INFO] Autoupdate is active, try to pull the latest sources for Calibre-Web ...
[INFO] ... current git status is
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
e6c6c26fd1ec363c3065f03c388a5d628ed6331e
[INFO] ... pulling sources
Already up-to-date.
[INFO] ... git status after update is
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
e6c6c26fd1ec363c3065f03c388a5d628ed6331e
[INFO] Launching Calibre-Web ...
Traceback (most recent call last):
File "/calibre-web/app/cps.py", line 13, in <module>
from cps import web
File "/calibre-web/app/cps/web.py", line 18, in <module>
import ub
File "/calibre-web/app/cps/ub.py", line 525, in <module>
Base.metadata.create_all(engine)
File "/usr/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 3918, in create_all
tables=tables)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1928, in _run_visitor
with self._optional_conn_ctx_manager(connection) as conn:
File "/usr/lib/python2.7/contextlib.py", line 17, in enter
return self.gen.next()
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1921, in _optional_conn_ctx_manager
with self.contextual_connect() as conn:
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2112, in contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2151, in _wrap_pool_connect
e, dialect, self)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1465, in _handle_dbapi_exception_noconnection
exc_info
File "/usr/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2147, in _wrap_pool_connect
return fn()
File "/usr/lib/python2.7/site-packages/sqlalchemy/pool.py", line 387, in connect
return _ConnectionFairy._checkout(self)
File "/usr/lib/python2.7/site-packages/sqlalchemy/pool.py", line 766, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/usr/lib/python2.7/site-packages/sqlalchemy/pool.py", line 516, in checkout
rec = pool._do_get()
File "/usr/lib/python2.7/site-packages/sqlalchemy/pool.py", line 1229, in _do_get
return self._create_connection()
File "/usr/lib/python2.7/site-packages/sqlalchemy/pool.py", line 333, in _create_connection
return _ConnectionRecord(self)
File "/usr/lib/python2.7/site-packages/sqlalchemy/pool.py", line 461, in init
self.connect(first_connect_check=True)
File "/usr/lib/python2.7/site-packages/sqlalchemy/pool.py", line 651, in
connect
connection = pool._invoke_creator(self)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 105, in connect
return dialect.connect(cargs, **cparams)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 393, in connect
return self.dbapi.connect(
cargs, **cparams)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file