Skip to content

Gollum via docker compose

Hooverdan96 edited this page Dec 19, 2024 · 9 revisions

Please note: the instructions below assume the following directory structure, with the actual git repository wikidata contained in the root directory gollum-wiki:

gollum-wiki $ tree -a
.
├── config.rb
├── docker-compose.yml
├── gitconfig
└── wikidata
    ├── .git
    └── Home.md

If you want to place your docker-compose.yml and/or your config.rb file in the same directory as the wiki files, you need to change docker-compose.yml to reflect these different locations. So e.g. ${PWD}:/wiki instead of ${PWD}/wikidata:/wiki.

Instructions

  1. Create the root folder:
mkdir gollum-wiki && cd gollum-wiki

Note: starting with version 6.0, the container will run with a non-root (UID/GID: 1000/1000) user by default. To ensure no permission failures during writes to the mapped working directory add the ownership change to the root folder:

mkdir gollum-wiki && chown 1000:1000 ./gollum-wiki && cd gollum-wiki
  1. Initialize the necessary files and repositories:
touch config.rb gitconfig
mkdir wikidata && git init wikidata
  1. Fill the config.rb file with all your favourite options.

  2. Mark the container's /wiki directory as safe for the container user (www-data) to trust.

git config --file gitconfig --add safe.directory /wiki

Without this, you will get this error when trying to access your gollum wiki: repository path '/wiki/' is not owned by current user. See the GitHub CVE-2022-24765 announcement for more details.

  1. Create docker-compose.yml:
version: "3.7"

services:
  gollum:
    image: gollumwiki/gollum:master
    restart: always
    ports:
      - "80:4567/tcp"
    volumes:
      - ${PWD}/config.rb:/etc/gollum/config.rb
      - ${PWD}/gitconfig:/home/www-data/.gitconfig
      - ${PWD}/wikidata:/wiki
    command:
      - "--config=/etc/gollum/config.rb"
  1. Start gollum in the background: docker-compose up -d