Skip to content

Building a Docker image from source

?/θ edited this page Aug 1, 2025 · 8 revisions

Images for this project are built and maintained by Open Fifth, and, once built, should be self-upgrading for the duration of a suite's lifetime. That said, you may wish to make your own adjustments to the image to aid in your building process. If this is the case, please read on - otherwise, see Using the k.d.d for instructions on how to build Koha from source using the images on DockerHub.

It is worth mentioning here, that these steps are written for Debian systems. While members of the Debian family, including Ubuntu, should work, they are untested. Arch-based systems such as Manjaro will not work, nor will Windows or macOS machines. You've been warned!

Cloning the repository

To build a Docker image, you'll be wise to clone this repository first. If you're a complete git novice, see the quick primer I wrote, Cloning with git. This repository is versioned against the Koha suites, so you'll notice a branch for 21.11, 22.11, etc. Open Fifth only supports the xx.11 releases of Koha, so if you wish to build another version, you'll need to modify the codebase to suit.

To clone a copy of this repository, run:

git clone --filter=blob:none --branch=22.11 https://github.com/openfifth/koha-dpkg-docker.git ~/koha-dpkg-docker

Make sure you replace the branch with the correct suite you wish to build!

Installing prerequisites

Firstly, we are going to need Docker, installed correctly (as per my own preferences ;-)) - to do this, please follow the Installing Docker correctly article, making minor adjustments for your own preferences.

Once Docker is installed, you'll next need to install Pbuilder. This is important for generating the initial base.tgz file, which is the Debian image within which the package gets built. To do this, please follow the Installing Pbuilder correctly arcticle, making minor adjustments for your own preferences.

Building the Docker image

With the prerequisites installed, we can turn our attention to building a k.d.d image. To begin, we need create an env file. I'd recommend just taking a copy of the one we provide:

cp ~/koha-dpkg-docker/default.env ~/koha-dpkg-docker/.env

If you so wish, you can edit the .env file, making any tweaks you desire. Generally, though, there shouldn't be a need for this, so operate at your peril.

With this now in-situ, we can build the Docker image. The fundamental process is to cd into the Git directory, and run ./build.sh. This script will walk through the whole process for you, based on the contents of the .env file. If you find anything not to your taste, chances are, tweaking the .env file is the solution. Give it a go, and remember, run as sudo!

cd ~/koha-dpkg-docker
sudo ./build.sh

From here, you've got a few options. You could push your image to DockerHub, or use the k.d.d with the image you've just built in lieu of the DockerHub image we provide. Your options are vast!

In any event, good luck, and good hunting!

Clone this wiki locally