Docker run wiki.js with sqlite

Problem

You want to run a simple wiki instance for your own or simple team use.

Solution

Use wiki.js and dockder:

1, Run wiki.js docker without mount volumn:

1
2
3
4
5
docker run -d \
-p 6060:3000 \
-e "DB_TYPE=sqlite" \
-e "DB_FILEPATH=/wiki/db.sqlite" \
ghcr.io/requarks/wiki:2

This step is just for letting wiki.js generate an empty sqlite database, so we can later map it for persistent saving.

Once the container is running, grab the container id, copy the generated db.sqlite to your local file system (we are using /home/john/data/db.sqlite for this example):

1
docker cp <container-id>:/wiki/db.sqlite /home/john/data/db.sqlite

2, Now stop the container:

1
docker stop <container-id>

3, Re-run the container, this time with the sqlite file mapping:

1
2
3
4
5
6
docker run -d \
-p 6060:3000 \
-e "DB_TYPE=sqlite" \
-e "DB_FILEPATH=/wiki/db.sqlite" \
-v /home/john/data/db.sqlite:/wiki/db.sqlite \
ghcr.io/requarks/wiki:2

All done, now you can visit localhost:6060 to see the wiki.js page.

If you want to run it under your own domain, simply put Nginx to proxy your localhost 6060

Reference