Document Validation Quick Start for Docker

Welcome to the Document Validation Quick Start Guide! This guide will take you through installing, configuring and running Document Validation for Docker.

System Requirements

Document Validation for Docker was built and tested using Docker 24.0.6 on Ubuntu 22.04.2 LTS.

Building the Docker Container

Before you can run the docker image, you must build it. The following command will be build the image and tag it with the name aware/document_validation.

docker build -t aware/document_validation .

Configuration

Document Validation can be configured by passing environment variables to the container when running the container:

DOCUMENTVALIDATION_REGULARURL

URL of the Regula Server.

DOCUMENTVALIDATION_LOGREQUESTS

Whether to log the requests/responses. Can be true (default) or false.

DOCUMENTVALIDATION_LOGREQUESTSDIRECTORY

Directory to save the requests/responses. Default is logs\request

Example usage:

docker run                                                               \
    ...                                                                  \
    --env DOCUMENTVALIDATION_REGULARURL=https://document.aware-demos.com \
    --env DOCUMENTVALIDATION_LOGREQUESTS=true                            \
    --env DOCUMENTVALIDATION_LOGREQUESTSDIRECTORY="logs/requests"        \
    ...

Running the Docker Image

To run the image the following command can be used:

docker run                      \
    -p 8095:8080                \
    --volume ./logs:/logs       \
    --detach                    \
    --restart always            \
    --name document_validation  \
    --env DOCUMENTVALIDATION_REGULARURL=https://document.aware-demos.com  \
    aware/document_validation

The command is broken down as follow:

  1. docker run: Initiates the process of running a Docker container.

  2. -p 8095:8080: Maps port 8080 inside the container to port 8095 on the host. This means you can access the service inside the container at localhost:8095.

  3. --volume ./logs:/logs: Mounts the local directory ./logs into the container at the path /logs. This allows logs generated within the container to be stored on the host machine.

  4. --detach: Runs the container in the background (in detached mode).

  5. --restart always: Configures the container to restart automatically unless explicitly stopped.

  6. --name document_validation: Names the container as document_validation for easier identification and management.

  7. --env DOCUMENTVALIDATION_REGULARURL=https://document.aware-demos.com: Sets an environment variable DOCUMENTVALIDATION_REGULARURL with the value https://document.aware-demos.com within the container. This passes the URL of the Regula server to the application running inside the container.

  8. aware/document_validation: Specifies the Docker image to use (aware/document_validation which was build in the previous section).

You can verify the container is start by doing:

docker ps

You can view the applications output with the following command:

docker logs document_validation

You can query the /version endpoint from the command line of the Docker host to ensure it is running correctly:

curl http://localhost:8095/documentValidation/version