28 May 2018

Omeka-S in Docker containers

Omeka-S is a next-generation web publishing platform for institutions interested in connecting digital cultural heritage collections with other resources online. It also publishes items on the semantic web with JSON-LD (linked open data).

The software is a LAMP server (Linux, Apache, MySQL, PHP).

Omeka-S official web site:

I am maintaining since some months a Docker image to be able to launch easily and rapidly an Omeka-S server by spinning up some Docker containers.

My Docker image can be found on Docker hub:

The files (Dockerfile, Docker compose YAML, etc.) are maintained on Git hub:

Some Omeka-S modules are included in the Docker image, but no MySQL/MariaDB server.

How to install Omeka-S on a Linux server with that Docker image:

Launch the containers

Install Docker and Docker-compose on your host (can be a physical or virtual machine).
Download the file "docker-compose.yml".
From the directory containing the "docker-compose.yml" file:
$ sudo docker-compose up -d
This will deploy three Docker containers:
  • Container 1: mariadb (mysql)
  • Container 2: phpmyadmin (connected to container 1; run behind nginx/php)
  • Container 3: omeka-s (connected to container 1; run behind apache/php)
With your browser, go to:
At that point, you can start configuring your Omeka-S web portal.
  • images will be downloaded automatically from the Docker hub: mariadb:latest, phpmyadmin:latest, dodeeric/omeka-s:latest.
  • for the omeka-s container, /var/www/html/files (media files uploaded by the users) and /var/www/html/config/database.ini (configuration file with the credentials for the db) are put in a named volume and will survive the removal of the container. The mariadb container also put the data (omeka-s db in /var/lib/mysql) in a named volume. Volumes are hosted in the host filesystem (/var/lib/docker/volumes).
To stop the containers:
$ sudo docker-compose stop
To remove the containers:
$ sudo docker-compose rm 
Remark: this will NOT delete the volumes (omeka and mariadb). If you launch again "sudo docker-compose up -d", the volumes will be re-used.
To login into a container:
$ sudo docker container exec -it <container-id-or-name> bash 
Build a new image

If you want to modify the omeka-s image (by changing the Dockerfile file), you will need to build a new image:
$ git clone https://github.com/dodeeric/omeka-s-docker.git
$ cd omeka-s-docker
Edit the Dockerfile file.
Once done, build the new Docker image:
$ sudo docker image build -t foo/omeka-s:1.0.1-bar .
$ sudo docker image tag foo/omeka-s:1.0.1-bar foo/omeka-s:latest
Upload the image to your Docker hub repository:
Login in your account (e.g. foo) on hub.docker.com, and create a repository "omeka-s", then upload your customized image:
$ sudo docker login --username=foo
$ sudo docker image push foo/omeka-s:1.0.1-bar
$ sudo docker image push foo/omeka-s:latest
Use Traefik as proxy

If you want to access all your web services on port 80 (or 443), you can use the Traefik reverse proxy and load balancer.
Here we have 3 web servers running (phpmyadmin, omeka-s, gramps). All are reachable on port 80 after launching this command:
$ sudo docker-compose -f docker-compose-traefik.yml up -d
All xxx.dodeeric.be dns names are directed to the Traefik container which will proxy them to the corresponding service container. The xxx.dodeeric.be dns names have to point to the IP of the Docker host.
With your browser, go to: (dodeeric.be is replaced by your dns domain; e.g. mydomain.com)
Traefik has a management web interface: http://hostname:8080
Only the Traefik container exposes its TCP ports (80, 443, 8080) on the Docker host; the service containers run on the private "network1" network.

You can also use the Portainer web interface to more easily manage your containers. To run Portainer on its default port 9000, just launch the following command:

$ sudo docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer:latest

Then, to access the web interface, go to: http://hostname:9000

Portainer web interface - Container list

Personally, I run Omeka-S in Docker containers on the following platform:

KVM Host:  

- HW: CPU: 8 (i7), RAM: 8 GB, Storage: 1 x SSD 250 GB + 2 x HDD 1 TB.
- OS: Ubuntu 18.04
- SW: KVM Hypervisor with Virt-Manager (Libvirt)

Docker Host:

- VM: CPU: 4, RAM: 4 GB, Storage: 2 x 20 GB (qcow2, virtio)
- OS: CentOS 7.5
- SW: Docker CE 18.05.0

Please note that running Omeka-S with the IIIF server and client (Universal Viewer) modules enabled can consume quite a lot of CPU: when zooming on media images with the Universal Viewer, the server has to produce images "on the fly" using the GD or Imagick PHP modules (or the ImageMagick command line) which is quite CPU intensive.

Zooming on a high resolution media image in the Universal Viewer.