Using Liferay Docker Images

Docker Hub hosts Liferay DXP and Liferay Portal Docker images, bundled with Tomcat on Linux. The Liferay Docker Hub pages provide image details and tags for the different releases.

These containers are standard Docker containers that can be started and stopped as such. The following examples use Docker CLI (docker), but you can use whatever Docker container tools you like.

Starting a Container for the First Time

The containers listens on port 8080 and starts like all Docker containers.

Warning

As of Liferay DXP 2024.Q2+/Portal 7.4 GA120+, Liferay’s Docker images still use JDK 8 by default and have not been updated with JDK 17 or 21. Create your Docker image using the -e JAVA_VERSION=zulu11 environment variable to use a supported JDK. Docker images are planned to be updated in the 2024.Q3 release.

  1. Run a container that maps a host port (e.g., 8080) to the container’s 8080 port.

    docker run -it -m 8g -p 8080:8080 -e JAVA_VERSION=zulu11 liferay/portal:7.4.3.112-ga112
    

    The container runs and prints log messages, including this Tomcat startup completion message:

    INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [xx,xxx] milliseconds
    
    Note

    Memory, CPUs, and other Docker container resources are configurable. The -m 8g command arguments above set the container’s memory limit to eight gigabytes. See the Docker runtime options for details.

  2. Sign in to Liferay at <http://localhost:8080> using the email address test@liferay.com and the password test.

  3. When prompted, change your password (e.g. learn) and click Save.

    Change your password upon first login.

Warning

In a production environment, you should not use the default admin account. Instead, create admin accounts specific to your business.

Liferay is ready to use.

Note

docker container ls lists each running container, including its ID and name. docker container ls -a lists all of your containers, including ones that aren’t running.

Viewing Logs

Liferay log messages and log files are available to view live and to copy to your host.

docker logs commands

The docker logs command prints container log messages.

CommandResult
docker logs [container]Outputs all of the current log messages
docker logs -f [container]Streams new log messages, like tail -f [file] does
docker logs -t [container]Appends a time stamp to each log message

docker cp command

You can use a docker cp command like the one below to copy a log file to your host machine.

docker cp [container]:/opt/liferay/logs/liferay.[timestamp].log .

Stopping a Container

Here are two ways to stop the container.

MethodProsCons
docker exec [container] /opt/liferay/tomcat/bin/shutdown.shAllows Liferay, Tomcat, and other apps to free resources. The container entry point runs any post-shutdown scripts.
Ctrl-C in the terminal session where you are running with the -i argument.

Note, this sends a SIGINT or SIGKILL signal to the attached container.
Fastest method to stop the container.Liferay, Tomcat, and the container entry point stop immediately, without freeing resources. The entry point’s post-shutdown phase is skipped. Don’t use this method in production environments

Restarting a Container

The containers can be restarted like all Docker containers.

docker start [container]
Warning

When a container is restarted, its entry point runs again (Please see Container Life cycle and API). Make sure any scripts you’re executing via the entry point can run again safely.

Tip

Run docker container ls -a to look up your container’s name or ID.

Now you know the basics of starting, stopping, and monitoring a Liferay container.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy