Skip to main content

Install With Docker Compose

Install Blur and Snapshot onPremise using Docker Compose

Install#

  1. Install Docker and Docker Compose

  2. Create a folder with a file named docker-compose.yml with the following content.

    docker-compose.yml
    version: "3.9"
    x-logging:  &default-logging  driver: "json-file"  options:    max-size: "100m"    max-file: "5"    mode: non-blocking
    services:  snapshot_sdk:    image: platerecognizer/alpr    environment:      - TOKEN=${SNAPSHOT_SDK_TOKEN}      - LICENSE_KEY=${SNAPSHOT_SDK_LICENSE_KEY}    volumes:      - snapshot_license:/license    logging: *default-logging    healthcheck:      test: [ "CMD", "curl", "-f", "http://localhost:8080/info" ]      interval: 5s      timeout: 2s      retries: 10
      skew_correction:    image: platerecognizer/skew-correction    environment:      - LOGGING=${LOGGING}      - SDK_URL=http://snapshot_sdk:8080      - BLUR=1      - TOKEN=${SNAPSHOT_SDK_TOKEN}      - LICENSE_KEY=${SNAPSHOT_SDK_LICENSE_KEY}
        depends_on:      snapshot_sdk:        condition: service_healthy
        logging: *default-logging    volumes:      - ${IMAGES_DIR}:/images    ports:      - "8001:8001"volumes:  snapshot_license:
  3. Create a folder with a file named .env with the following contents.

    .env
    COMPOSE_PROJECT_NAME=blurSNAPSHOT_SDK_TOKEN=4805bee1222ce85e0b#####################SNAPSHOT_SDK_LICENSE_KEY=6xD#####LOGGING=INFO
    # CLIIMAGES_DIR=/tmp/samples# APISERVER=1

Upgrade#

Open a terminal in the folder with the compose file and run the following commands:

docker compose pulldocker compose restart

Run#

Blur provides different modes of usage, first pull the images by running the command below in the folder with compose file:

docker compose pull

CLI Mode#

  1. Update IMAGES_DIR with the path to your images in the .env file
  2. Comment out the line SERVER=1 in the .env
  3. Start the services using the following command:
    docker compose up skew_correction

API Mode#

  1. Ensure the line SERVER=1 in the .env is not commented out
  2. Comment out volumes from skew_correction service in docker-compose.yml, After comments:
    docker-compose.yml
    logging: *default-logging# volumes:#   - ${IMAGES_DIR}:/imagesports:  - "8001:8001"
  3. Start the services using the following command:
    docker compose up # To start services in the background add -d option after up
  4. The REST API will be listening on port 8001