Trials and Tribulations with Technology

Run Wiki.js with Docker

I'm thinking about self-hosting a wiki as an online knowledge base for myself. Wiki.js looked appealing but it was hard to find an example online to play with, so I did a quick local install with Docker to try it out.

Ultimately, it's not for me. It's not theme-able yet; the default theme wastes too much page real estate and there's no easy way to change that. It also takes too many clicks to create a page for quickly creating notes. I think it would be a great solution for a more polished corporate wiki, documentation, or more structured writing than what I'm planning.

Anyway, I took notes while setting it up locally, this is what I did while following the Wiki.js Docker Install instructions.

You can use sqlite for local development. The docs strongly recommend using postgresql, and recommend against using sqlite in production...but you can probably get away with it on a small site?

Create a sqlite DB file:

sqlite3 database.sqlite "VACUUM;"

Download the sample configuration file config.sample.yml from the docs & edit it to use sqlite, with a DB file location of: /wiki/database.sqlite This is the location within the Docker container.

Run the Docker container:

docker run \
  --rm \
  --user root \
  --publish 8080:3000 \
  --name wiki \
  --volume $PWD/database.sqlite:/wiki/database.sqlite \
  --volume $PWD/config.sample.yml:/wiki/config.yml \

The  --user root argument is needed, otherwise accessing the the DB fails with permissions issues:

2020-12-17T04:55:03.925Z [MASTER] error: Database Initialization Error: 
create table migrations (id integer not null primary key autoincrement,
name varchar(255), batch integer, migration_time datetime) - 
SQLITE_READONLY: attempt to write a readonly database

Now you can access Wiki.js locally at: http://localhost:8080

When you "install" Wiki.js by completing the form, be sure to update the URL to match the localhost: http://localhost:8080