Skip to main content
Version: v2

Docker Compose deployment

The Docker Compose deployment runs the single-image container. The API, worker, and models are bundled into one unit.

Prerequisites​

Quick start​

Clone the doc-ver-ops repository and initialize a deployment:

git clone git@github.com:microblink/doc-ver-ops.git
cd doc-ver-ops/docker-compose
bash init.sh <deployment_name> <license_key> <application_id>

This creates a docker-compose/<deployment_name> directory containing docker-compose.yaml and environment configuration.

Start the deployment:

cd <deployment_name>
docker-compose up -d

The API is available on port 8080 by default.

Configuration​

Configuration is managed through conf/doc-ver-image/.env inside your deployment directory.

Key environment variables:

  • DOC_VER_API_PORT: port the API listens on (default: 8080)
  • WORKER_COUNT: number of worker processes per container (default: 2)
  • API_TIMEOUT_SECONDS: request timeout in seconds (default: 30)
  • JOB_TIMEOUT_MINUTES: maximum job duration in minutes (default: 2)
  • LIMITS_CPUS / LIMITS_MEMORY: container resource limits
  • RESERVATIONS_CPUS / RESERVATIONS_MEMORY: container resource reservations

Logging​

Logs are written to stdout/stderr by default. View them with:

docker-compose logs doc-ver

File logging is disabled by default. Set LOG_FILES_ENABLED=1 to also write logs inside the container to:

  • /var/log/tf-serving.log
  • /var/log/api.log
  • /var/log/worker-N.log

If the container filesystem fills up due to log growth, the process may crash. Prefer external log collection over in-container log files.

Throughput and scaling​

A single container with default settings handles roughly 0.8 requests per second. On average, a single verification takes 2–3 seconds.

The internal queue buffers request spikes; the API returns 429 when the queue is saturated.

Scale horizontally by running more containers behind a load balancer. Avoid increasing WORKER_COUNT without also increasing resource limits—horizontal scaling has better return than vertical tuning.

Migrating from the multi-service compose​

  1. Stop and remove the old stack: docker-compose down
  2. Remove old config directories: conf/doc-ver-api, conf/doc-ver-runner, conf/bundle-doc-ver
  3. Re-run init.sh to generate the single-image config
  4. Start the new stack: docker-compose up -d