How to start Vikunja API in Docker with sqlite?

I’ve started a Docker container, with a volume mounted at /storage. I then start Vikunja with the following environment variables:

VIKUNJA_DATABASE_PATH: /storage/vikunja.db

However, Vikunja API fails to start:

usermod: no changes
2020/06/22 07:53:59 Config File "config" Not Found in "[/app/vikunja /etc/vikunja /app/vikunja/.config/vikunja]"
2020/06/22 07:53:59 Using default config.
2020-06-22T07:53:59.935817756Z: CRITICAL	▶ migration/Migrate 002 Migration failed: unable to open database file: no such file or directory

I’ve checked that /storage exists by replacing the command with ls -la /storage:

total 24
drwxr-xr-x    3 root     root          4096 Jun 21 17:19 .
drwxr-xr-x    1 root     root          4096 Jun 22 07:57 ..
drwx------    2 root     root         16384 Jun 21 17:19 lost+found

Why isn’t the vikunja.db created when the API starts?

Vikunja is not running as root in docker, therefore the api process has no rights to write in the /storage directory. You should modify the folder so the vikunja run user has the right to access it. Take a look at the docs for more info. Since you’re mounting /storage as a volume would need to do this at the host running the container.

I’ll put up a fix to improve the error message.

Better error message is implemented as of caee123f9.

Thanks for your response! I’ve set PUID and PGID to 1000 and have ensured the host volume is chowned to 1000:1000. Now, the API server indeed seems to start correctly. Thanks!

1 Like

Glad it works for you now!