Legacy Knowledge Base
Published Jul. 2, 2025

Where to place pre-startup scripts in Liferay Workspace

Written By

Jorge García Jiménez

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

We are building Docker images so we run the task "gradle buildDockerImage" to build our image.

We would like to know the following:

Where do we have to place in our workspace "pre-startup" scripts?

We have tried to create the folder in common or specific environment folder but then the scripts are not appearing in /usr/local/liferay/pre-startup

 

Environment

  • Liferay 7.3 with Liferay Workspace

Resolution

You have to place the scripts inside below route:

 ${LR_WORKSPACE_HOME}/configs/docker/scripts

 

Sample script

Selection_069.png

Is executed when docker image is run

Selection_070.png

However, scripts placed in you workspace:

 ${LR_WORKSPACE_HOME}/configs/docker/scripts

before building the image are just copied to:

 /home/liferay/configs/local/scripts 

during the image creation, and then during the startup of the container they are copied to

 /mnt/liferay/scripts 

as seen in the logs:

[LIFERAY] Copying /home/liferay/configs/local/scripts scripts files:

/home/liferay/configs/local/scripts
└── my_custom_script.sh

[LIFERAY] ... into /mnt/liferay/scripts

These scripts, however, are only executed before Liferay DXP starts as stated in the official doc:

[LIFERAY] Executing scripts in /mnt/liferay/scripts:

[LIFERAY] Executing my_custom_script.sh.
[CUSTOM SCRIPT] Hello, I'm a custom script copied during the creation of the image!

So they play the role of pre-startup scripts but are not copied to /usr/local/liferay/pre-startup folder actually.  To achieve this, you have to bind mount a local folder, place there the required scripts of each phase there and start the container as documented here.

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base