Welcome to the official OpenCms Docker image maintained by Alkacon.
Here you find a Docker Compose setup with a ready to use OpenCms installation including Tomcat and MariaDB.
OpenCms can be used with other databases and Servlet containers as described in the OpenCms documentation.
Images for older OpenCms versions are also available, see here.
Save the following docker-compose.yml file to your host machine.
version: '3.7'
services:
mariadb:
image: mariadb:latest
container_name: mariadb
init: true
restart: always
volumes:
- ~/dockermount/opencms-docker-mysql:/var/lib/mysql
environment:
- "MYSQL_ROOT_PASSWORD=secretDBpassword"
opencms:
image: alkacon/opencms-docker:14.0
container_name: opencms
init: true
restart: always
depends_on: [ "mariadb" ]
links:
- "mariadb:mysql"
ports:
- "80:8080"
volumes:
- ~/dockermount/opencms-docker-webapps:/usr/local/tomcat/webapps
command: ["/root/wait-for.sh", "mysql:3306", "-t", "30", "--", "/root/opencms-run.sh"]
environment:
- "DB_PASSWD=secretDBpassword"
Change the MariaDB root password secretDBpassword
.
Adjust the following directories for your host system:
~/dockermount/opencms-docker-mysql
the directory where all MariaDB data are persisted~/dockermount/opencms-docker-webapps
the Tomcat webapps directory that contains important configurations, caches and indices of OpenCms
Configured in this way, it is possible to upgrade the opencms
and mariadb
containers while keeping all your OpenCms and MariaDB data. See the upgrade guide below.
On the other hand, if you like to start with a completely fresh OpenCms installation, do not forget to delete both mounted directories before.
Navigate to the folder with the docker-compose.yml file and execute docker-compose up -d
.
Startup will take a while since numerous modules are installed.
You can follow the installation process with docker-compose logs -f opencms
.
When the containers are set up, you can access OpenCms via http://localhost/system/login
.
The default account is user name Admin
with password admin
.
In addition to DB_PASSWD
, the following Docker Compose environment variables are honored:
DB_HOST
, the database host name, defaults tomysql
DB_USER
, the database user, default isroot
DB_PASSWD
, the database password, is not set by defaultDB_NAME
, the database name, default isopencms
ADMIN_PASSWD
, the admin password, defaults toadmin
OPENCMS_COMPONENTS
, the OpenCms components to install, default isworkplace,demo
; to not install the demo template useworkplace
TOMCAT_OPTS
, the Tomcat startup options, default is-Xmx1g -Xms512m -server -XX:+UseConcMarkSweepGC
WEBRESOURCES_CACHE_SIZE
, the size of tomcat's resources cache, default is200000
(200MB)DEBUG
, flag indicating whether to enable verbose debug logging and allowing connections via {docker ip address}:8000, defaults tofalse
JSONAPI
, flag indicating whether to enable the JSON API, default isfalse
SERVER_URL
, the server URL, default ishttp://localhost
If you have installed OpenCms 13.0 and want to upgrade to OpenCms 14.0, proceed as follows:
Enter the target version of the OpenCms image in your docker-compose.yml file.
opencms:
image: alkacon/opencms-docker:14.0
Make sure that you have persisted your OpenCms data and MariaDB data with a Docker mount as described above. Otherwise you will loose your data.
Navigate to the folder with the docker-compose.yml file and execute docker-compose up -d
.
During startup, the Docker setup will update several modules as well as JAR files and configurations in the {CATALINA_HOME}/webapps
directory.
You can follow the installation process with docker-compose logs -f opencms
.
Since the image is available on Docker Hub, you do not need to build it yourself. If you want to build it anyway, here's how to do it:
Download the opencms-docker repository.
Go to the repository's main folder and type docker-compose build opencms
.
View the licence information on GitHub.