Using Dockerfiles to Build Custom Images

Explains how to use Dockerfiles to build a custom image for the Application Protector Java container.

Protegrity base images use the default RHEL Universal Base Image. Using Dockerfiles, you can use a base image of your choice.

To create custom image:

  1. Download the installation package.

    For more information about downloading the installation package, refer to the section Extracting the Installation Package.

    Important: The dependency packages required for building the Docker images are specified in the HOW-TO-BUILD file, which is a part of the installation package. You must ensure that these dependency packages can be downloaded either from the Internet or from your internal repository.

  2. Perform the following steps to build a Docker image for the Sample Application container.

  3. Run the following command to extract the files from the ApplicationProtector-SAMPLE-APP_SRC_<version_number>.tgz file to a directory.

tar -C <dir> ApplicationProtector-SAMPLE-APP_SRC_<version_number>.tgz

The following files are extracted:

  • APJAVA_RHUBI_SAMPLE-APP_DOCKERFILE
  • APJavaSetup_Linux_x64_<version_number>.tgz
  • docker-entrypoint.sh
  • passwd.template
  • pom.xml
  • libs directory - Contains the ApplicationProtectorJava.jar file.
  • src directory - Contains the source files for the Sample Application.
  1. Perform the following steps to create an application from the source file.

    1. Install Maven 3.2 or later.
    2. Execute the following command to build the Spring application.
      mvn clean install
      

    The apjava-springboot-0.1.0.jar is created in the ./target directory.

  2. Run the following command in the directory where you have extracted the contents of the ApplicationProtector-SAMPLE-APP_SRC_<version_number>.tgz file.

docker build --build-arg BUILDER_IMAGE=<Repository location of rhel ubi 9 base image> \
         --build-arg BASE_MICRO_IMAGE=<Repository location of rhel ubi 9 micro base image> \
         -t <image-name>:<image-tag> -f APJAVA_RHUBI_DOCKERFILE_<version_number> .

For more information the Docker build command, refer to the Docker documentation.

For more information about tagging an image, refer to the AWS documentation.

  1. Run the following command to list the Sample Application container image.
docker images
  1. Push the Sample Application container image to your preferred Container Repository.

For more information about pushing an image to the repository, refer to the section Uploading the Images to the Container Repository.

  1. Repeat step 2 - 3 and 5 - 7 for creating custom images for RPProxy, KMSProxy, and Log Forwarder containers and extracting the source package of the respective component.
    Each extracted source package contains the corresponding Dockerfile. The steps to create custom images using the Dockerfile are same for all the images. Step 4 is not required.

Last modified : January 09, 2026