Dokuwiki Farm in a (Docker) Container

Today I released my Dokuwiki Farm container image on Docker Hub.

It is perhaps a little clunky and experimental, but it is the first image that I have published but it’s a fairly simple solution to hosting Dokuwiki.

It can run in single wiki mode, or it can run as an entire wiki farm with the option of shared logins between farm animals.

The base image

For this we are taking the nginx:mainline-alpine image as it is very small and has the basic Nginx setup. We then install php5-fpm, git and supervisord.

Nginx does an fcgi proxy pass to PHP-FPM for serving our Dokuwiki, we pre-configure the container to accept all domains and serve pages as per the prescribed configuration. The real ‘magic’ is to configure the farm in the container using the equivalent of the ‘vhost’ method of setup.

Grabbing the image

To grab a copy of this container image, simply run:

docker pull xanmanning/dokuwiki-farm

Farm Animals

On running this image in your own container you can mount the /var/www/farm directory to your Docker host. Inside this directory you will find another directory called _animal - this is the base template for creating new animals in your farm.

$ ls -a ./farm
.  ..  .gitignore  _animal

To create a new animal simply copy (or rsync) the _animal directory to the URL you will provide your wiki, eg:

$ cp -r ./farm/_animal ./farm/{wiki,wiki2}

This will make a new wiki available to ‘’ and ‘’.

Wiki Animals

Example docker-compose.yml and Nginx vhost

If you want to run this on your system behind an Nginx reverse proxy I have provided an example configuration.

Nginx vhost

The below configuration will set up a vhost listening to all the wiki URLs provided and route the traffic towards the container. The way the container is set up it will automatically select the correct animal (as long as the directory exists).

In my example I have two server names:

server {
    listen                        80;
    listen                        [::]:80;
    client_max_body_size          20M;

    # Add each wiki URL to your server_name.
    # The container will select the correct animal.

    server_name         ;

    location / {
        proxy_set_header          Host              $host;
        proxy_set_header          X-Forwarded-Proto $scheme;
        proxy_set_header          X-Real-IP         $remote_addr;
        proxy_set_header          X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header          Proxy             "";

        proxy_pass                http://localhost:8088;


This file is set up to mount the volumes to your current working directory. It will also do a git pull each time the container is re-started ont he stable branch.

We are also going to share users between Wiki farm animals.

    image: xanmanning/dokuwiki-farm:latest
    restart: always
        - 8088:80
        - "./conf:/var/www/dokuwiki/conf"
        - "./data:/var/www/dokuwiki/data"
        - "./inc:/var/www/dokuwiki/inc"
        - "./farm:/var/www/farm"
        - DW_SSO=1
        - DW_GIT_PULL=1

Running docker-compose up -d will start the container, once done visit the installer for the main wiki (not in the farm) - once installed you can visit your new farm animals!