docker properties DevOps Jahia 8

How to permanently change Jahia properties in Jahia docker images?

Question

I am using Jahia docker images from docker community and I need to permanently change Jahia settings so they are effective after a reboot. How can I do that if the container is recreated every time I restart it?

Answer

The link First steps with Jahia shows how to start a default Jahia docker image in development mode. If one wants to, let's say, put Jahia in read only mode permanently (readOnlyMode=true) they should make use of a Dockerfile.

Here is one example on how to set your Dockerfile and change the default jahia.properties file from Jahia docker image jahia-dev by a custom one, stored in your local directory, with the property readOnlyMode set to true as mentioned before:

FROM jahia/jahia-dev:latest

# Local copy of jahia.properties to container path
COPY jahia.properties /opt/jahia/dx/digital-factory-config/jahia/jahia.properties

WORKDIR /opt/jahia/dx

CMD ./start.sh

After that one should build the new image

docker build .

Sending build context to Docker daemon  54.27kB
Step 1/5 : FROM jahia/jahia-dev:latest
 ---> 16120e527d33
Step 2/5 : COPY digital-factory-config/jahia/jahia.properties /opt/jahia/dx/digital-factory-config/jahia/jahia.properties
 ---> Using cache
 ---> 820b567c6942
Step 3/5 : COPY digital-factory-config/jahia/jahia.node.properties /opt/jahia/dx/digital-factory-config/jahia/jahia.node.properties
 ---> Using cache
 ---> fa7dffdea1b3
Step 4/5 : WORKDIR /opt/jahia/dx
 ---> Using cache
 ---> 4365af3521c6
Step 5/5 : CMD ./start.sh
 ---> Using cache
 ---> a40eee1598f3
Successfully built a40eee1598f3

And finally run the container. The ID can be obtained from the output from "docker build" command or by running a "docker images -a" to show all available images

docker run a40eee1598f3

The following link contains an example of Dockerfile and jahia properties structure ready to be changed, built and ran: Jahia Dockerfile