Using the Koha Docker image - digibib/koha-docker GitHub Wiki

Some basic docker knowledge is recommended, as it is important to know you'll be working in a virtualized environment. Three main concepts:

Docker image

The built and immutable/snapshot of a Koha Setup is composed in an image, that is layers of code that compose the entire filestructure needed to run.

Docker container

When you start a container, you typically pick an image, say digibib/koha:ae2356fc325... then insert some ENV variables to customize it, add some ports to expose FROM inside the container TO your machine.

This is done by a docker run command, e.g.

docker run -d --name myKoha \
	-p 6001:6001 -p 8080:8080 -p 8081:8081 \
	-e KOHA_INSTANCE=myKoha \
	-e KOHA_ADMINUSER=admin \
	-e KOHA_ADMINPASS=secret \
	-e SIP_WORKERS=3 \
	-e SIP_AUTOPASS1=autopass \
	-t digibib/koha:[revision]

Here we -d (detach) so it runs forever/until it dies or we kill it, exposes port 6001 (SIP server) 8080 (OPAC) and 8081 (Intra). We give it the name koha_docker for ease.

Docker entrypoint

This is where all customization/post-setup happens. When we start the container above, the initial command run is the entrypoint docker-entrypoint.sh which is a script that sets up Koha and applies and customizes everything. The actual setup and customization of Koha is done in an invoked script install.sh which clicks through the Koha webinstaller, sets up mysql, hooks and other quirks and then returns control to the entrypoint.

Since Koha is composed of several services, we have installed a deamon to control all: supervisord. This is the final part of the entrypoint and setup, and takes the main control after installation.

Supervisord

The following services that Koha consist of are controlled by supervisord: apache2, plack, sipserver, zebra, cron, syslog. They can all be restarted without killing the main process:

supervisorctl -u$KOHA_ADMINUSER -p$KOHA_ADMINPASS restart plack

Any live change that need flush/restart of sysprefs requires plack restart, for instance.

Docker exec - Entering / Working inside the Koha container

to enter a running Koha container, you would simply start a shell in the container:

docker exec -it myKoha bash

You are then in a root shell of the virtualized environment, in which you can do anything...