Defining customized logic with run engine commands and extension points
In this lesson, you define customized Docker start-up logic with run engine commands and extension points.
Before you begin
About this task
This method defines the customized logic in run engine commands and execute the commands through extension points. The run engine commands define how to customize the logic and the extension points define when to customize the logic.
In this lesson, suppose we have created a run engine command named
cus-command-name
. To deploy run engine commands:
Procedure
- Create a new cus folder in the local environment.
-
Create a preConfigure.sh file in the local folder with the following code
lines:
#!/bin/bash wget -O '/SETUP/ run-engine-cus.zip' "http://nexusServer:8081/nexus/service/local/artifact/maven/redirect?r=snapshots&g=run-engine-cus&a= run-engine-cus &v=@version@&p=zip" && \ unzip /SETUP/crs-app-cus.zip -d /SETUP/
-
Create a custConfiguration.sh file in the local folder with the following
code lines:
In this command,#!/bin/bash Run cus-command-name <parameter1> <parameter2> Run OOTB-command-name <parameter1> <parameter2>
cus-command-name
is the customized run engine command you created;OOTB-command-name
is the pre-defined run engine command. -
Create a Docker file with the following code lines:
FROM docker-repo/commerce/crs-app:tag COPY preConfigure.sh /SETUP/bin/ COPY custConfiguration.sh /SETUP/bin
-
Build the custom Docker image:
docker build -t docker-repo/commerce/crs-app:cus
Results
Lessons
Learned
Customizing Docker images with run engine command is very flexible. You only need to define what you want to do in preconfigure.sh and custConfiguration.sh. When the container is created and started, the container will execute the commands.