Skip to content
Dawa Ometto edited this page Apr 16, 2024 · 44 revisions

Running Gollum via Docker

Note: we have stopped using latest tag to avoid confusion that can occur when using this tag name. Please use the versioned tags, or the master tag for an image that includes the latest features and bugfixes.

A Gollum wiki can be run inside a Docker container on Windows, Mac, or Linux. The official Docker image on Dockerhub for Gollum is gollumwiki/gollum.

Pulling

For example:

  • docker pull gollumwiki/gollum:master (latest commit to master branch)
  • docker pull gollumwiki/gollum:5.3.3 (specific version)
  • docker pull gollumwiki/gollum:5.3 (will pull the latest version from the 5.3 range, e.g. 5.3.3)

The image tagged master is based on the github master branch, and is deployed to DockerHub whenever an update to that branch passes the build.

Running

After pulling, the following will allow you to access your wiki at http://127.0.0.1:4567/ on the host machine:

  • docker run --rm -p 4567:4567 -v $(pwd):/wiki gollumwiki/gollum:5.3
    • -v $(pwd):/wiki tells Docker to use the current working directory as the git repository you want to serve your wiki from
    • alternatively e.g. -v /path/to/my/git/repo:/wiki
    • add the -d flag to the command before the image name (gollumwiki/gollum:tagname) to run Gollum in the background

Any flags after the image name (gollumwiki/gollum:tagname) will be passed to the gollum command, so you can use all of Gollum's command line options. For example:

docker run --rm -p 4567:4567 -v $(pwd):/wiki gollumwiki/gollum:master --mathjax --h1-title

Using docker-compose

An example approach to using Gollum with docker-compose can be found here.

Building your own Docker image

The following guide is aimed at those who want to create their own image, and assumes a minimal working knowledge of Docker. Note that there are also some ready-to-use 3rd Party Docker images at docker Hub. See below.

Prerequisite: Docker

If you don't have Docker already installed, Docker Toolbox is a convenient package of the Docker binary, VirtualBox (which is used to house containers) and a GUI called Kitematic. Download the version for your operating system here: https://www.docker.com/docker-toolbox

After Docker installs, choose to launch the Docker Quickstart Terminal which will automatically setup Docker and VirtualBox for the first time.

Be sure to note the IP of the docker virtual machine, if running through VirtualBox!

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/


docker is configured to use the default machine with IP 123.456.78.90
For help getting started, check out the docs at https://docs.docker.com

Preparing the Gollum Workspace

  • Create a new folder on your machine to house your Wiki. This guide will assume ~/my-gollum-wiki
  • Navigate to the workspace folder and create a new, local Git repository. This is what Gollum will use to save commits.
cd ~/my-gollum-wiki
git init

Run the latest docker hub container

Docker Location

  • If you are not in the ~/my-gollum-wiki location, then go there first
docker run --rm --name gollum -d -v $(pwd):/wiki -p 4567:4567 gollumwiki/gollum:master

The docker image will be pulled down if necessary, then will go into the background.

Note When running on Windows, the host path may need to be prepended with an extra slash as shown below: Special thanks to (https://github.com/dduportal-dockerfiles/docker-compose/issues/1) for highlighting this issue.

This will bind our current folder as a symlink to the container's /wiki folder. Note: if Docker is running inside VirtualBox (e.g. on Windows or Mac) then this is the IP of VirtualBox as noted above, not localhost of the OS. See the following discussion on setting up automatic VirtualBox forwarding to localhost: https://forums.docker.com/t/using-localhost-for-to-access-running-container/3148/3

Accessing the Gollum GUI

3rd Party Docker images at Docker Hub

There are a couple of ready-to-use Gollum Docker Images to be found at Docker Hub. A quick overview

Podman

Using Podman in rootless mode on a SELinux-enabled system (e.g. Fedora), you may have to do something like this:

podman pull gollumwiki/gollum:master
podman run --name gollum --rm --security-opt label=disable --userns=keep-id -v "${PWD}":/wiki -p 4567:4567 gollumwiki/gollum:master

--userns=keepid is needed if using a image built after ad6d910. Check the owner of /wiki inside the container; it should be www-data.