Dockerize Omeka CMS
Jun 27, 2018
Aldrin Navarro
4 minute read

Dockerize Omeka CMS

We had this activity in our “Advanced Computer Systems” class to deploy a collections archive website using a content management system written in PHP, Omeka CMS. What is Omeka CMS?

Omeka provides open-source web publishing platforms for sharing digital collections and media-rich online exhibits.


What Omeka CMS is for? Resource sharing. Sharing resources is a valuable asset for hobbyists, enthusiasts, educational institutions and government offices. OMEKA provides such perk plus offers a lot more like publishing collections and digital contents through online exhibits.

alt My omeka website aptly called 221B Coder Street :D
My omeka website aptly called 221B Coder Street :D

Just in time, I am also learning Docker. In a nutshell, Docker creates a portable container or package for applications and services. It’s not only useful in development, it also takes a lot of provision, test and ship process. It makes it easy to bundle software requirements and dependencies. Many have adopted Docker as a go-to solution for containerizing the technology stack in order to have a product ready for development and production. It is no surprise that famous technologies written in PHP, like Wordpress, has a readily available Docker image.

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.


alt Docker
Admit it. It’s cute.

At the time, I have limited knowledge in using Docker all the while getting rusty in PHP. The instuctions given to us assumes installation and deployment on a bare metal server. Yet I still manage to get approval from my professor to use Docker. Just making sure this will be not all for nothing in the end just because I have a different method from the rest of the class.

Our goals:

  • Create Dockerfile for our simple docker image
  • Use Docker Compose for defining and running services
  • Deploy and use the CMS

It’s important to know the following points too:

Manual setup and deploy

Omeka CMS specifications is a standard LAMP stack. In detail its the following:

  • Apache HTTP server (with mod_rewrite enabled)
  • MySQL >= v5.0
  • PHP >= v5.3.2
  • ImageMagick image manipulation software

A typical flow will look like this

$ sudo apt update && sudo apt install apache2 -y
# Make sure UFW firewall allows HTTP(S) traffic for Apache
sudo ufw allow in "Apache Full"
sudo apt install mysql-server -y
sudo apt install -y php libapache2-mod-php php-mcrypt php-mysql
# Enable mod_rewrite
sudo a2enmod rewrite && sudo /etc/init.d/apache2 restart
sudo apt install -y imagemagick

Next is to install and configure Omeka. Download the latest version of Omeka from Unzip the downloaded file and move to the directory discoverable by Apache web server.

# replace x.x by version downloaded
unzip /var/www/html
# set permissions to the web server
chown -R www-data:www-data /var/www/html/files

At this point, the only thing left is to update db.ini to have the correct database configuration.

host = "<localhost-or-server-ip>"
username = "omekauser"
password = "omekapass"
dbname = "omekadb"
prefix = "omeka_"
charset = "utf8"
;port = ""

Now check http://localhost-or-ip/ and you should see Omeka ready for use.

Setup and deploy using Docker

Our Dockerfile will be trimmed-fat version of the manual setup above.

FROM ubuntu:16.04
LABEL maintainer="Wonderful Being <[email protected]>"

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
    zip unzip \
    php7.0 \
    apache2 \
    libapache2-mod-php7.0 \
    php7.0-mysql \
    php7.0-xml \
    imagemagick \
    openssh-server \
    vnstat \

# Enable mod_rewrite
RUN a2enmod rewrite && /etc/init.d/apache2 restart

# RUN rm /var/www/html/index.html
ADD omeka-2.6 /var/www/html
# Update the default apache site with the config we created.
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf
# Set permissions
RUN chown -R www-data:www-data /var/www/html/files

COPY --chown=root:root omekactl /

VOLUME ["/var/www", "/var/log/apache2", "/etc/apache2"]
ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

A companion docker-compose.yml may look as simple as this

version: '3.3'

    image: omeka:dev
    env_file: .env
    restart: always

Development workflow will look like this

docker build -t omeka:dev .
# compose
cd omeka-build
docker-compose up -d
# persist common files
docker volume create file-vol
docker volume ls
docker volume inspect file-vol
docker run --rm -d \
-p 4000:80 \
-v file-vol:/var/www/html/files \
--name omekabox \
# debugging service
docker exec -it omekabox bash
# stopping service
docker stop omekabox


A ready-to-run Docker image is available at the store so deploying your own will be as easy as:

docker pull aldnav/omeka:alpha
docker volume create file-vol
docker run --rm -d \
-p 80:80 \
-v file-vol:/var/www/html/files \
--name omekabox \

Proceed to Omeka by visiting http://localhost/install/


Easy “A”.

I am happy for what the project has turned out. I get to learn the basics of Docker. There are a lot of things to improve.

You can check out my repository for the entirety of the project at

🐋 hello there! If you enjoy this, a "Thank you" is enough.

Or you can also ...

Buy me a teaBuy me a tea

comments powered by Disqus