Manage Exits with Docker

Rule Engine can be run in Docker on Redhat, so it is necessary to have a way to compile exits and import them in a container. For this, you can use the Docker image ais/ais-ruleenginefile-exit/2.3.0:<tag name>, which provides the environment to compile exits.

Compile exits in the container

To compile exits in the container:

1. Start the container with the docker run command:

docker run -it -e LOCAL_USER_ID=`id -u $USER`

--name [ExitContainer_Name] \

ais/ais-ruleenginefile-exit/2.3.0:<tag name>

Caution   Use the --name option to set a name to the container which will be used to import the volume.

2. Import exits Cobol or C files to this container using the docker cp command:

docker cp EXIEME.cbl [ExitContainer_Name]:/home/ai-user/\

RuleEngineFile/runtimes/EXEC/exit

Note   The source files must be either copied one by one with docker cp, or using the volume ‘-v’ option to share a directory containing the source files with the container. The following command does not work: docker cp *.cbl [ExitContainer_Name]:/home/ai-user/RuleEngineFile/runtimes/EXEC/exit

3. Mount a local directory into the container:

  • Add the following option to the docker run command:
  • docker run -v [local_directory]:/home/ai-user/ \
  • RuleEngineFile/runtimes/EXEC/exit_src
  • Where exit_src is the name of the directory where the source files are located.
  • Use a Unix cp command to copy the files in the $RDJ_EXEC/exit directory inside the container.
Caution   You must provide a name different from ‘exit’ which would overwrite the previously existing ‘exit’ directory.

4. The working directory is $RDJ_EXEC/exit. You must set some environment variables by launching the following command : exit$ ] . ./rdjenv

5. Compile the exits by using the make -f exitfic.mak command.

6. Retrieve the library using the docker cp command. For example, the following command retrieves the libexieme.so file to the current working directory:

docker cp [ExitContainer_Name]:/home/ai-user/ \ RuleEngineFile/runtimes/EXEC/exit/libexieme.so .

Notes:

  • The files must be copied one by one. The following command does not work:
  • docker cp [ExitContainer_Name]:/home/ai-user/ \
  • RuleEngineFile/runtimes/EXEC/exit/*.so .
  • The volume mounted through the ‘-v’ option can also be used to retrieve these files using a standard Unix cp command.

Use the exits in a container

The library files can be embedded in a customer container using a COPY command inside a Dockerfile. However you can also use the library files in another container without using the docker cp command.

Since the ais/ais-ruleenginefile-exit/2.3.0:<tag name> image exports the $RDJ_EXEC/exit directory as a volume, it can be referenced in the customer container using the --volumes-from option with the name given when running the ais/ais-ruleenginefile-exit/2.3.0:<tag name> image:

docker run -it -e LOCAL_USER_ID=`id -u $USER`

--volume-from [ExitContainer_Name] \

[Customer_ExitImage_Name]

Related Links