Container Lifecycle and API

Container Lifecycle and API

At a high level, the container starts Tomcat with Liferay deployed on it. Additionally, however, the container entry point provides an API for executing these use cases:

  • Invoking scripts
  • Configuring Tomcat and Liferay
  • Deploying artifacts
  • Installing patches
  • Updating the Patching Tool

The container provides an API for triggering and configuring these use cases. It executes the use cases in different phases of its lifecycle.


After you create a container in an environment, the container entry point executes the following lifecycle phases in that environment:

  1. Pre-configure: Runs user-provided scripts before configuring Tomcat and Liferay.
  2. Configure: Prepares for running Liferay on Tomcat.
    1. Set Tomcat’s Java runtime environment.
    2. Copy user-provided files to Liferay Home.
    3. Run user-provided scripts.
    4. Deploy user-provided artifacts.
    5. Update the Patching Tool with the user-provided version.
    6. Install user-provided patches.
  3. Pre-startup: Runs user-provided scripts before starting Tomcat.
  4. Tomcat startup: Launches Tomcat using the Catalina script.
  5. Post-shutdown: Runs user-provided scripts after Tomcat stops.


The container entry point scans the following container folders for files and uses those files to configure the container, Tomcat, and Liferay and to act on Liferay.

  • /mnt/liferay
  • /user/local/liferay/scripts

You can pass files to these container folders in several different ways, including using bind mounts, volumes, and docker cp. See Providing Files to the Container for more information.

The key folders above have subfolders that are designated for specific actions. The subfolders, the actions taken on their files, and associated use cases are listed in lifecycle phase order in the following sections.

The following lifecycle phases act on user-provided files.

Pre-Configure Phase API

File Location Action Use Cases
/usr/local/liferay/scripts/pre-configure Run scripts in alphabetical order Running scripts before the Configure Phase

Configure Phase API

File Location Action Use Cases
/mnt/liferay/files Copy files to corresponding folders under Liferay Home (/opt/liferay) Configuring Containers

Configuring Tomcat
/mnt/liferay/scripts Run scripts in alphabetical order Running scripts during configuration
/mnt/liferay/deploy Symbolically link /mnt/liferay/deploy to /opt/liferay/deploy for auto-deploying artifacts at Liferay startup.

At run time, auto-deploy any artifacts copied into /mnt/liferay/deploy, into /opt/liferay/deploy, or into any folder mounted to either folder.

Note: Auto-deployed artifacts are moved to appropriate folders under /opt/liferay/osgi.
Installing apps and other artifacts to Containers
/mnt/liferay/patching If a Patching Tool is provided, install it. Install any patches provided. Patching DXP in Docker

Pre-Startup Phase API

File Location Action Use Cases
/usr/local/liferay/scripts/pre-startup Run scripts in alphabetical order Running scripts before starting Tomcat

Post-Shutdown Phase API

File Location Action Use Cases
/usr/local/liferay/scripts/post-shutdown Run scripts in alphabetical order Running scripts after shutting down Tomcat

What’s Next

Now that you’re familiar with the container lifecycle and API, you can determine the best ways to provide files to the container. You can alternatively start exercising the use cases mentioned in the tables above. They’re listed here for your convenience: