Skip to main content

Docker Compose

The Docker Compose deployment runs the on-prem image as one container holding the API, the processing workers, and the runtime models. Use it for a single host. For a cluster, see Kubernetes and Helm.

Prerequisites​

  • Docker 20.10.5 or newer
  • Docker Compose 2.22.0 or newer
  • A Linux AMD64 host
  • A license key and application ID
  • The image tag for the release you're deploying

The deployment files are in the on-prem-ops repository:

git clone https://github.com/microblink/on-prem-ops.git

The Compose file and the environment template are under deploy/docker-compose/.

Configure the deployment​

Copy docker-compose.yaml and .env.example into your deployment directory, and rename .env.example to .env.

Keep .env out of version control and restrict access to it: it holds your license key.

.env
BLINKID_VERIFY_IMAGE=us-docker.pkg.dev/document-verification-public/on-prem/core
BLINKID_VERIFY_IMAGE_TAG=4000.0.2
BLINKID_VERIFY_API_PORT=8080

LICENSE_KEY=<license-key>
LICENSE_APPLICATION_ID=<application-id>
DOCVER_WORKFLOW=ExtractAndVerify
WORKER_COUNT=2

BLINKID_VERIFY_INFLIGHT_LIMIT=2
BLINKID_VERIFY_QUEUE_LIMIT=0
LOG_FILES_ENABLED=0

LIMITS_CPUS=4
LIMITS_MEMORY=8G
RESERVATIONS_CPUS=2
RESERVATIONS_MEMORY=4G

Set BLINKID_VERIFY_IMAGE_TAG to the version for the release you're deploying, and leave the image repository unchanged unless you were given a different registry. Keep DOCVER_WORKFLOW=ExtractAndVerify unless you're running an extraction-only deployment.

See Environment variables for every supported setting and its default.

Always keep the memory limit set. Overload protection is a percentage of the container memory limit, and it's disabled when there is no limit, so without one the container can't reject requests before it runs out of memory.

The reference defaults reject excess requests immediately rather than building an in-container backlog. Review the capacity settings before changing the admission limits.

Start the deployment​

docker compose --file docker-compose.yaml up -d

The API is available on port 8080 by default. Wait for it to become ready:

curl --fail http://localhost:8080/health/ready

Then send a request:

curl --fail --location --output sample-front.jpg https://storage.googleapis.com/microblink-data-public/microblink-api/test-set/blinkid/SGP_ID_FRONT_new/SGP_ID_FRONT_sample.jpg
curl --fail --location --output sample-back.jpg https://storage.googleapis.com/microblink-data-public/microblink-api/test-set/blinkid/SGP_ID_BACK_new/SGP_ID_BACK_sample.jpg
curl --request POST --form "imageFirstSide=@sample-front.jpg" --form "imageSecondSide=@sample-back.jpg" http://localhost:8080/api/v3/verify

Logs and status​

docker compose --file docker-compose.yaml ps
docker compose --file docker-compose.yaml logs -f blinkid-verify

The container writes component logs to standard output and standard error. Optional file logging is described under Logging.

Stop the deployment​

docker compose --file docker-compose.yaml down

Update the deployment​

Change the image tag to the release you're moving to, then recreate the container:

docker compose --file docker-compose.yaml pull
docker compose --file docker-compose.yaml up -d

Review the changelog for configuration or API changes before updating.