Skip to main content

Docker environment variables

Environment variables are for the current version and may differ for a previous versions.

Mandatory variables are marked with an asterisk (*).

VariableDescriptionTypeDefault value
LICENSEE*Your licenseeString
LICENSE_KEY*Your license keyString
PORTExposed port for APIInteger8080
MAX_REQUEST_SIZEMax http request sizeString100MB
GRACEFUL_SHUTDOWN_TIMEOUTGraceful shutdown timeout in duration format.DurationPT15S
WRAPPER_PATHPath for wrapper to override autoconfiguration. Can be used if you want to skip automatic CPU architecture detection.String
WORKER_TIMEOUT_MSMax time waiting for a recognition process to finish.Integer20000
WORKERS_POOL_SIZENumber of recognition workers in a worker pool.Integer2
WORKER_CREATION_MSMilliseconds to wait for license check at startup. Lower values will result in faster startup but invalid license will be reported on requests.Integer100
AVAILABLE_WORKER_TIMEOUT_MSMax time waiting to get available recognition worker from the pool.Integer10000
ENABLE_METRICSEnable metrics endpoint.Booleanfalse
ENABLE_HEALTH_ENDPOINTSEnable health, liveness and readiness endpoints.Booleantrue
ENABLE_SECURITYEnable basic security.Booleanfalse
BASIC_AUTH_USERNAMEUsername for Basic authentication header.String
BASIC_AUTH_PASSWORDPassword for Basic authentication header.String
IMAGE_ALLOW_INVALID_CERTIFICATEWhether to allow download of images from Url with invalid certificate.Booleantrue
IMAGE_DOWNLOAD_TIMEOUTMax time for image download from provided image Url.Integer10000
IMAGE_MAX_SIZE_KBMax image size in kilobytes. Empty value means unlimited.Integer
IMAGE_URL_PROTOCOLS_ALLOWEDAllowed protocols for image download.Comma-separated stringhttp,https
IMAGE_URL_HOSTS_ALLOWEDAllowed hosts for image download. Empty value means all hosts are allowed.Comma-separated string
IMAGE_URL_PORTS_ALLOWEDAllowed ports for image download. Empty value means all ports are allowed.Comma-separated integer
IMAGE_URL_DIRECTORIES_ALLOWEDAllowed directories for image download. Empty value means all directories are allowed. Works only if file protocol is specified.Comma-separated string
ENABLE_REQUEST_SUMMARYWhether to enable request summary in log.Booleantrue
LOG_ENABLE_CUSTOMIZATIONWhether to allow logger customizations (Guard for LOG_ENABLE_CONSOLE_APPENDER, LOG_ENABLE_FILE_APPENDER, LOG_PATTERN and LOGGER_MAP).Booleanfalse
LOG_ENABLE_CONSOLE_APPENDERWhether to enable console appender.Booleantrue
LOG_ENABLE_FILE_APPENDERWhether to enable file appender. Log files are placed inside docker container in /logs folder.Booleanfalse
LOG_PATTERNCustom pattern for logback. You can use %X{traceId} and %X{executionId} from MDC to track request.String
LOGGER_MAPLogger key-values pairs. For more detailed logging provide "com.microblink=DEBUG,io.micronaut=INFO"Comma-separated string=string pairs
ALLOW_CORSWhether to enable CORS.Booleantrue
ALLOWED_METHODSCORS allowed methods.Comma-separated stringGET,POST,OPTIONS
ALLOWED_ORIGINSCORS allowed origins. Empty value means all origins are allowed.Comma-separated string
PROXY_HOSTThe host name of the proxy server.String
PROXY_PORTThe port number of the proxy server.Integer
NON_PROXY_HOSTSThe list of hosts that should be reached directly, bypassing the proxy. This is a list of patterns separated by | .String
TRUST_STORETrust store path.String
TRUST_STORE_PASSWORDTrust store password. Needed only if a trust store is password protected.String
SSL_ENABLEDWhether SSL is enabled.Booleanfalse
SSL_KEY_STORE_PATHSSL key store path.String
SSL_KEY_STORE_PASSWORDSSL key store password.String
SSL_KEY_STORE_TYPEType of keystore.String
SSL_KEY_STORE_PROVIDERName of the key store provider.String
SSL_KEY_PASSWORDSSL key password.String
SSL_KEY_ALIASSSL key alias.String
JAVA_OPTSRuntime Java options for GraalVM native image.String
HEALTH_CUSTOM_URLCustom health endpoint.String

Recommended Docker runtime options for throughput of 1.5 req/s are 4 CPUs, 4 GB of memory and 2 workers (WORKERS_POOL_SIZE).

It is strongly recommended to configure Cross-origin resource sharing (CORS) policy control in order to minimize security risks by using the following environment variables ALLOW_CORS, ALLOWED_METHODS, ALLOWED_ORIGINS. The second recommendation is to use https instead of http for external service interaction, for example, setting IMAGE_URL_PROTOCOLS_ALLOWED only to https (which is the default setting). Finally, it is recommended to implement API rate limiting based on the number of requests made to the specific API endpoint based on the request per time or IP address for example by using load balancer, proxy, horizontal scaling policy, etc.