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.

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: