Legacy Knowledge Base
Published Sep. 10, 2025

How to Have the Deploy Folder in the initcontainer Persist to be Available to the Container

Written By

Kenny Back

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

  • Is there a way for the deploy folder created in the initcontainer to persist and be available to the container?

Environment

  • DXP 7.4

Resolution

  • A potential solution would be to use a shared volume between the containers. You can use volumes in init containers in Kubernetes. Volumes can be shared between init containers and the main application containers within the same pod. Here's a general outline of how you can define and use volumes in init containers:
  1. Define the Volume: You define the volume in the pod specification.
  2. Mount the Volume in Init Container: Mount the volume in the init container as needed.
  3. Mount the Volume in Application Container: Mount the same volume in the main application container.
  • Here's an example YAML configuration illustrating these steps: 
apiVersion: v1 
kind: Pod
metadata:
name: example-pod
spec: volumes:
- name: shared-data
emptyDir: {}

initContainers:
- name: init-container
image: busybox
command: ['sh', '-c', 'echo "Initializing..." > /mnt/data/init.log']
volumeMounts:
- name: shared-data
mountPath: /mnt/data

containers:
- name: app-container
image: busybox
command: ['sh', '-c', 'cat /mnt/data/init.log && sleep 3600']
volumeMounts:
- name: shared-data
mountPath: /mnt/data

 Additional Information

 

 

Did this article resolve your issue ?

Legacy Knowledge Base