Written by The Jahia Team
   Estimated reading time:

Volume management

Containers work in a counter-intuitive way for those used to handling barebone computers or virtual machines. Modifications made to the files of a container at runtime are non-persistent and will be discarded at some point.

To store persistent data, you use a volume. Volumes are stored in the container's host filesystem as a folder and persist across restarts and container redeployments. They can also be shared across multiple containers at the same time.

The -v option is used to mount a volume on the container:

docker run -p 8080:8080 -v {/path to the host machine’s folder or file}:{/container’s path where to mount the volume} jahia/jahia-dev:{Jahia version}

For more detailed information on how volumes work, see the Docker documentation.

In a Jahia setup, volumes are useful for making Jackrabbit indexes and modules persistent.

Jahia Module deployment in containers

Module deployment in containers is usually achieved through the module management API. See the module management tutorial for more details. Alternatively, modules can be deployed manually through the module management administration interface.

About building a custom image embedding custom modules

An alternative to deploying the modules via a REST API is to embed them into a custom Docker image. This is usually not a good idea, since the life cycle of the image would be bound to any change to the version of the custom modules. On top of that, the module management API provides unique features, such as the ability to start, stop, and undeploy a module.

Custom configuration management

Custom configuration deployment

The Jahia configuration usually lives in the jahia.properties and jahia.node.properties files. All the configuration entries stored in these files can be overridden by passing environment variables to the container, which is a good practice with Docker.

For example, to initialize the Jahia configuration karaf.remoteShell.port:

  1. Translate the karaf.remoteShell.port property name with its environment variable equivalent: jahia_cfg_karaf_remoteShellPort.
  2. Run the Docker container by using the -e option to set an environment variable:
    docker run -p 8080:8080 -p 20101:20101 -e jahia_cfg_karaf_remoteShellPort=20101
     jahia/jahia-dev:{dx version}

Once the containerized Jahia starts, you can see the updated configuration in Support Tools:


Accessing the container’s bash console

To access the container’s bash command console from the host machine, execute the following Docker command:

docker exec -it {container_id} /bin/bash

Now you can execute any command that you want from the container’s command console.

If you only need to execute one command in the container, you could instead use this method:

docker exec -it {container_id} {your command}

Custom certificate authority certificates (Cacerts) deployment in Tomcat

Tomcat can embed certificate authority certificates (cacerts). The -v parameter can be passed to docker run to mount truststores to Tomcat:

docker run -p 8080:8080 -v /path/to/the/cacertfile:/usr/local/openjdk-11/lib/security/cacerts/cacertfile jahia/jahia-dev: