Trace: dokuwiki

DokuWiki

DokuWiki

DokuWiki is a self-hosted open source wiki. It is highly versatile and simple to use. Dokuwiki uses a “flat file” system that doesn't require a database. I use it for documenting my homelab; you are using it/looking at it right at this very moment.

Setup

docker pull dokuwiki

resulted in:

Error response from daemon: pull access denied for dokuwiki, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

so I built my own Docker image by…

1. downloading the source code tarball
2. extracting it to ~/docker/containers/dokuwiki

tar -xvzf dokuwiki-a6b3119b5d16cfdee29a855275c5759f.tgz -C ~/docker/containers/dokuwiki --strip-components=1

3. creating the Dockerfile

nano ~/docker/containers/dokuwiki/Dockerfile

with the content:

FROM php:7.4-apache
LABEL maintainer="Your Name <[email protected]>"
COPY . /var/www/html/
RUN chown -R www-data:www-data /var/www/html/
VOLUME /var/www/html/data

4. then building the image:

docker build -t my-dokuwiki-image .

Once the image was built, I started the container with

docker run -d -p 23627:80 -v ~/docker/containers/dokuwiki/data:/var/www/html/data --name dokuwiki my-dokuwiki-image

When I initially tried to access Dokuwiki at 10.10.10.222:23627, I got:

DokuWiki Setup Error

The datadir ('pages') at ./data/pages is not found, isn't accessible or writable. You should check your config and permission settings. Or maybe you want to run the installer?

but when I clicked “run the installer” it brought me right back to the same page/message so I changed the permissions all files and subdirectories in dokuwiki to 777. That allowed me to get Dokuwiki installed so I changed the file permissions back to the Dokuwiki defaults of 755 for directories and 644 for files (read and execute permissions for Apache and read-only permissions for everyone else) and made sure ownership was set to www-data (Apache)

find ~/docker/containers/dokuwiki -type d -exec chmod 755 {} \;
find ~/docker/containers/dokuwiki -type f -exec chmod 644 {} \;
sudo chown -R www-data:www-data ~/docker/containers/dokuwiki