Community OpenKM Docker Container

OpenKM Login Screen
 

In conjunction with work we have done on other projects, FlyingFlip worked to set up the community edition of the OpenKM document management system via Docker for the purposes of evaluating OpenKM for a client project.

This project is periodically updated and maintained and we wanted to share our implementation and solution. The OpenKM container currently supports the “on-board” H2 database and also supports MySQL out of the box.

For complete information on the docker containers being used, you can go on over to the corresponding DockerHub or GitHub pages for complete information.

https://github.com/ElusiveMind/openkm
https://hub.docker.com/r/mbagnall/openkm

The current version as of this build for the community edition is 6.3.12

To get OpenKM running locally, use the following docker-compose.yml configuration. You will want to update the URL and base URL configurations to match where you would like this hosted. As a matter of course, it runs on port 8080. Our recommendation is to use a reverse proxy such as Nginx to proxy to the container.

services:

  # Our base OpenKM service is at the localhost. If hosting these on a domain,
  # change the "localhost:8080" to your domain and optionally change the ports.
  # if you are using ingress as a proxy, then you can make the exposed port anything
  # but it must map to 8080 on the container.
  openkm:
    image: mbagnall/openkm:mysql
    container_name: openkm
    environment:
      OPEN_KM_URL: http://localhost:8080/OpenKM
      OPEN_KM_BASE_URL: http://localhost:8080
    ports:
      - 8080:8080
    volumes:
      - ./data:/opt/tomcat-8.5.34/repository
    depends_on:
      - db
    restart: unless-stopped
  
  # We need to start our MySQL service without grant tables and with an init
  # file to create the user. This allows the magic process of "start service,
  # start using". If you need a more secure environment, be sure to check out
  # the information in the readme.
  db:
    image: mysql:5.7
    container_name: openkm-datastore
    command: --skip-grant-tables --init-file=/opt/init-file/init-file.sql
    environment:
      MYSQL_ROOT_PASSWORD: OpenKM77
      MYSQL_ALLOW_EMPTY_PASSWORD: 0
    expose:
      - 3306
    volumes:
      - ./openkm-datastore:/var/lib/mysql
      - ./openkm-init-file:/opt/init-file
    restart: unless-stopped

  # Optional PHPMyAdmin service. Recommended for localhost only. Not secure in
  # prod with the --skip-grant-tables option in place.
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: openkm-phpmyadmin
    ports:
      - 8081:80
    environment:
      - PMA_HOST=db
    depends_on:
      - db
    restart: unless-stopped

For the initial configuration and execution, you will need to create a file called ‘init-file.sql’ and mount it as presented in the configuration above. This will allow for the creation of the database and users needed by OpenKM to access the MySQL database.

CREATE DATABASE okmdb DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;
CREATE USER 'openkm'@'%' IDENTIFIED BY 'OpenKM77';