NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.
Issue
- I have a problem with the fact that Liferay's official DXP Docker images are based on Ubuntu, so I want to make an image for myself, with Red Hat
-
So I am currently building a custom Docker image on a Red Hat Linux operating system, following these steps:
1. Downloaded Liferay DXP 7.4 - u77 bundle with Tomcat.
2. Extracted it into the 'liferay' folder.
3. Created the attached Dockerfile.
4. Run "docker build -t my-liferay-image ."
5. Started the container with "docker run -d -p 8080:8080 --name my-liferay-container my-liferay-image."
After following these steps, when attempting to start the container, I encountered the following exception:2024-07-19 10:12:11 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
2024-07-19 10:12:11 at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
2024-07-19 10:12:11 Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
2024-07-19 10:12:11 at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
2024-07-19 10:12:11 at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
2024-07-19 10:12:11 at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
2024-07-19 10:12:11 ... 1 more
Environment
- 7.4
Resolution
- Disclaimer: please note that when running DXp under Docker, only our official Docker images are supported.
- If you will use such an image to run you DXP and later on there will be some problems (that ultimately might have something to do with this choice) we will not be able to assist and we will only be able to verify, to test on an official DXP image, as the documentation states:
All reported image and product issues will be diagnosed using the official Liferay Docker image at the reported tag or fix pack level.
- Having said that, please find attached a modified dockerfile that might work (without any guarantees).
Steps:
Create an empty folder e.g. test
Inside it create a new folder liferay
Unzip the content of the downloaded official liferay bundle into liferay folder
Open the terminal from the test folder
Rundocker build . -t myimage
Rundocker run -d -p 8080:8080 --name my-test myimage