Using Docker
Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers with everything the software needs to run, including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.
A Docker image is available at our private Docker repository at https://docker.openkm.com. It is the easiest way to get OpenKM running on your server. If you want to use this image, please submit a support ticket, and we will provide you with access to the repository.
Please refer to the Docker documentation for installation instructions and to learn more about Docker.
Once Docker has been installed, create the proper openkm.properties file or configure it using the environment variables and execute this command to get your OpenKM instance:
$ docker run --name openkm -p 8080:8080 -v ${PWD}/openkm.properties docker.openkm.com/private/professionalAfter that, point your browser to http://localhost:8080/. The default user and password are “okmAdmin” / “admin”.
This way, you can create a container with the default embedded H2 database (not recommended for production, but just fine for testing):
$ docker run -d --name openkm -p 8080:8080 -v myvol:/opt/tomcat \ -e DATABASE_DRIVER=org.h2.Driver \ -e DATABASE_URL=jdbc:h2:/opt/tomcat/okmdb \ -e DATABASE_DIALECT=com.openkm.db.dialect.H2Dialect \ --restart=unless-stopped docker.openkm.com/private/professional:7.1.13This is a sample that can be used to create a container using MySQL, but the recommended way is to use Docker Compose:
$ docker run -d --name openkm -p 8080:8080 -v myvol:/opt/tomcat \ -e DATABASE_DRIVER="com.mysql.cj.jdbc.Driver" \ -e DATABASE_URL="jdbc:mysql://172.17.0.1:3306/dbtest?useUnicode=true&characterEncoding=UTF8&serverTimezone=CET&nullNamePatternMatchesAll=true" \ -e DATABASE_USER="openkm" \ -e DATABASE_PASSWORD="openkm" \ -e DATABASE_DIALECT="com.openkm.db.dialect.MySQL5InnoDBDialect" \ --restart=unless-stopped docker.openkm.com/private/professional:7.1.13The database can be created this way:
CREATE USER 'openkm'@'%' IDENTIFIED BY 'openkm';CREATE DATABASE dbtest DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;GRANT ALL ON dbtest.* TO 'openkm'@'%' WITH GRANT OPTION;To see the container logs:
$ docker logs -f openkmTo stop the container:
$ docker stop openkmTo start it again:
$ docker start openkmTo access the container:
$ docker exec -ti openkm bashFor more actions, please check the Docker documentation site.
Configuration
Section titled “Configuration”These are the environment variables that can be used to configure the OpenKM container:
| Variable | Description |
|---|---|
| DATABASE_DRIVER | The JDBC database driver connects to the database. |
| DATABASE_URL | The JDBC URL to connect to the database. |
| DATABASE_USER | The database user. |
| DATABASE_PASSWORD | The database user password. |
| DATABASE_DIALECT | The Hibernate database dialect. |
Docker Compose
Section titled “Docker Compose”To make all this configuration easy, we recommend using Docker Compose. Please refer to Docker Compose documentation for installation instructions and more info.
This is a sample Docker Compose configuration file using environment variables, where MySQL is used as the database:
version: '3.2'
services:
openkm_mysql: image: docker.openkm.com/private/professional:7.1.13 container_name: openkm_mysql hostname: openkm ports: - 8080:8080 volumes: - openkm_mysql:/opt/tomcat environment: - DATABASE_DRIVER=com.mysql.cj.jdbc.Driver - DATABASE_URL=jdbc:mysql://mysql:3306/okmdb?useUnicode=true&characterEncoding=UTF8&serverTimezone=CET&nullNamePatternMatchesAll=true - DATABASE_USER=openkm - DATABASE_PASSWORD=openkm - DATABASE_DIALECT=com.openkm.db.dialect.MySQL5InnoDBDialect - TZ=Europe/Madrid entrypoint: [ "wait-for-it.sh", "mysql:3306", "--timeout=0", "--strict", "--", "entrypoint.sh" ] links: - mysql:mysql networks: skynet: ipv4_address: 172.28.1.1
mysql: image: mysql:8.0.18 container_name: okmdb_mysql hostname: mysql command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8 --collation-server=utf8_bin volumes: - okmdb_mysql:/var/lib/mysql environment: - MYSQL_DATABASE=okmdb - MYSQL_USER=openkm - MYSQL_PASSWORD=openkm - MYSQL_ROOT_PASSWORD=openkm security_opt: - seccomp:unconfined networks: skynet: ipv4_address: 172.28.1.2
volumes: openkm_mysql: okmdb_mysql:
networks: skynet: ipam: driver: default config: - subnet: 172.28.0.0/16This is another sample Docker Compose configuration:
version: '3.2'
services:
openkm_mysql: image: docker.openkm.com/private/professional:7.1.13 container_name: openkm_mysql hostname: openkm ports: - 8080:8080 volumes: - ${PWD}/openkm.properties:/opt/tomcat/openkm.properties - ${PWD}/repository:/opt/tomcat/repository environment: - TZ=Europe/Madrid entrypoint: [ "wait-for-it.sh", "mysql:3306", "--timeout=0", "--strict", "--", "entrypoint.sh" ] links: - mysql:mysql networks: skynet: ipv4_address: 172.28.1.1
mysql: image: mysql:8.0.18 container_name: okmdb_mysql hostname: mysql command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8 --collation-server=utf8_bin volumes: - ${PWD}/mysql:/var/lib/mysql environment: - MYSQL_DATABASE=okmdb - MYSQL_USER=openkm - MYSQL_PASSWORD=openkm - MYSQL_ROOT_PASSWORD=openkm security_opt: - seccomp:unconfined networks: skynet: ipv4_address: 172.28.1.2
networks: skynet: ipam: driver: default config: - subnet: 172.28.0.0/16This is the openkm.properties file:
# OpenKM Hibernate configuration valuesspring.datasource.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource.url=jdbc:mysql://mysql:3306/okmdb?useUnicode=true&characterEncoding=UTF8&serverTimezone=CET&nullNamePatternMatchesAll=truespring.datasource.username=openkmspring.datasource.password=openkm
# JPA stuffspring.jpa.hibernate.ddl-auto=create-onlyspring.jpa.properties.hibernate.dialect=com.openkm.db.dialect.MySQL5InnoDBDialect
# Clustercluster.enabled=falsecluster.node=master
# Logging configspring.output.ansi.enabled=always