Effortless Liferay Orchestration: Advanced Docker Scripts for Local Development

How I consolidated two years of shell utilities into a cross-platform Python manager with Gemini.

Peter Richards
Peter Richards
A Minute Read

From Shell Scripts to Python: Streamlining Liferay DXP Orchestration

As Liferay developers, we often build "quality of life" scripts to handle the repetitive parts of our workflow. I’ve been using my own set of internal tools since early 2024 to manage DXP versions and environment snapshots. In November 2025, I decided it was time to share them with the community.

Originally a collection of standalone shell scripts, I have recently worked with Gemini to port the core logic to Python and consolidate everything into a single, cohesive manager. The result is a more robust, cross-platform toolset that simplifies container orchestration, configuration persistence, and snapshot workflows.

The Challenge: Managing Local Complexity

Standard Docker commands are great, but they often fall short when you need to run multiple isolated instances of Liferay DXP or move complex data between environments. This suite provides a high-level manager that handles the specialized needs of a Liferay developer.

Key Features of the Suite:

  • Unified Python Manager: By moving the logic to Python, the tool now offers a consistent experience across macOS, Linux, and Windows via simple wrappers.

  • Standardized Project Layout: The scripts automatically create a root directory that mirrors Liferay Home, bind-mounting critical folders like /data, /deploy, and /osgi/state for immediate persistence and easy manual configuration.

  • Proactive Collision Detection: To prevent environment corruption, the manager performs "Fast-Fail" checks. It detects if a requested HTTP port, Elasticsearch port, or even a specific database schema is already in use by another running container on the same loopback IP.

  • Multi-Instance Session Isolation: You can run different portals on the same port (8080) by using unique virtual hostnames. The tool automatically renames session cookies and handles the necessary security whitelisting in portal-ext.properties to prevent 403 Forbidden errors and cross-instance logouts.

  • Full-Stack Snapshots: Create and restore complete snapshots of both your database (PostgreSQL, MySQL, or Hypersonic) and your filesystem with a single command.

Quick Start Example

Running a new instance with a specific DXP tag is now a one-liner:

Bash

./liferay-docker.sh run --tag 2025.q4.11

If you need to isolate this instance on a custom hostname:

Bash

./liferay-docker.sh run --host-name liferay.local -p 8080

Snapshot and Restore

Need to back up your state before trying out a new client extension or upgrade?

Bash

# Create a named snapshot
./liferay-docker.sh snapshot --name "Pre-Upgrade-Backup"

# View and restore snapshots
./liferay-docker.sh snapshots
./liferay-docker.sh restore

Get the Scripts

The repository includes the Python manager, shell/batch wrappers, and example host configurations to help you get started.

Check it out on GitHub: Liferay Docker Scripts

I’d love to hear how these tools work for your development flow!

Page Comments

Related Assets...

No Results Found

More Blog Entries...