So, I upgraded my server to the latest Ubuntu release and Wallabag broke. I remember I had a tough time upgrading Wallabag. So this time, I decided to run it as a Docker container to avoid issues.

Unfortunately, this also had a few challenges!

Most of the stuff on my server run using flat files or SQLite databases, so I referred to the official Wallabag docs for running it on Docker. It gave the docker run command, but I wanted it as a docker-compose.yml file instead.

To convert the docker run command to a docker-compose.yml file I headed over to the Composorize site and got this.

version: "3"

    image: wallabag/wallabag
    container_name: wallabag
      - /opt/wallabag/data:/var/www/wallabag/data
      - /opt/wallabag/images:/var/www/wallabag/web/assets/images
      - 80:80
      - SYMFONY__ENV__DOMAIN_NAME=http://localhost

However, when I ran this I got some weird error!

[+] Building 0.0s (0/0)                                                                                                                  
[+] Running 1/1
 ✔ Container wallabag  Recreated                                                                                                   8.0s 
Attaching to wallabag
wallabag  | Starting wallabag ...
wallabag  | wc: /var/www/wallabag/data/db/wallabag.sqlite: No such file or directory
wallabag  | Configuring the SQLite database ...
wallabag  |   SQLSTATE[HY000] [14] unable to open database file  
wallabag exited with code 14

This was strange! Finally after searching for the error, I came across a response on Github

Upon investigation, the problem seems to be that it tries and fails to create the file /var/www/wallabag/data/db/wallabag.sqlite.

It can fail for 2 reasons:

  1. It requires the sub-directory db to already exist.
  2. It tries to create the SQLite file as the user nobody and fails unless that user has write-access to the db directory.

Essentially, the docker mount volumes have to have a different user:group setting and the db directory needs to exist.

Ran the following commands –

mkdir -p /opt/wallabag/data/db
mkdir -p /opt/wallabag/images

And finally –

chown -R nobody:nogroup /opt/wallabag

Now, running docker compose up worked!