OpenKM Community edition via Docker

O

In conjunction with work I have done on other projects, I 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.

I periodically update and maintain this and wanted to get the word out here in the event anyone is looking for this as a solution.

The OpenKM container currently supports the “on-board” H2 database and also supports MySQL. 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.11. Look for a dedicated project page coming soon with more information on using OpenKM.

To get OpenKM running locally, use the following docker-compose.yml configuration:

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

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';

About the author

Michael Bagnall

I am a web solutions architect working to develop PHP, JavaScript and Docker-based solutions in the public and private sector. Currently working out of the Middle Tennessee area, I am also an avid Ice Hockey fan and also play in an adult league. In addition to CodeRefactored.com, I also blog on hockey related items at BagOfPucks.com.

By Michael Bagnall

Recent Posts

PROJECTS

Tag Cloud