Gollum via Docker

Adhityaa edited this page May 28, 2018 · 25 revisions

A Gollum wiki can be run inside a Docker container on Windows, Mac or Linux. The following guide assumes 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

Prerequisite: Git

'nuff said.

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

Creating the Dockerfile

  • Ensure one is (still) in the Docker Quickstart Terminal window/Open a new command prompt
  • Create a new file in the workspace folder with the exact name of Dockerfile and paste the following contents inside:
FROM ruby
RUN apt-get -y update && apt-get -y install libicu-dev cmake && rm -rf /var/lib/apt/lists/*
RUN gem install github-linguist
RUN gem install gollum
RUN gem install org-ruby  # optional
ENTRYPOINT ["gollum", "--port", "80"]

This file will instruct Docker to:

  1. baseline its image from the official Ruby repo on Docker Hub
  2. install developer tools, gollum and its dependencies (e.g. for the GUI). Note: You can install any of the rendering gems supported by gollum.
  3. change the working directory of the Docker container to and provide an external symlink (for the actual OS to connect to) for a folder inside the container called /wiki
  4. start the gollum engine automatically on port 80
  5. expose the container's port so we can connect to it on our machine

Building the Docker image

  • Ensure one is (still) in the Docker Quickstart Terminal window/Open a new command prompt
  • Navigate to the folder that houses the Dockerfile, ~/my-gollum-wiki/
  • Run the following command to build an image from the Dockerfile with a tagname of gollum
docker build -t gollum .

After the terminal is done working away, the console will say Successfully built with the image ID created.

Running the Docker Container

  • Now we'll spin up a container based on the image created
  • Ensure one is (still) in the Docker Quickstart Terminal window/Open a new command prompt
  • Navigate to the folder of our git repository, ~/my-gollum-wiki/
  • Run the following command to boot up our image tag-named gollum:
$ docker run -v `pwd`:/wiki -p 4567:80 gollum

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.

$ docker run -v /`pwd`:/wiki -p 4567:80 gollum

This will bind our current folder as a symlink to the container's /wiki folder and forward port 80 of the container to port 4567 (Gollum's default). 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

The gollum instance can be further customized at runtime by passing command line options at the end of the docker run invocation.

$ docker run -v `pwd`:/wiki -p 4567:80 gollum --live-preview

Note: the symlink and port forwarding can also be setup using the Kitematic GUI once the container is running.

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

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.