Open source OCR-as-a-Service using Tesseract and Docker

Download as .zip Download as .tar.gz View on GitHub

OpenOCR makes it simple to host your own OCR REST API.

The heavy lifting OCR work is handled by Tesseract OCR.

Docker is used to containerize the various components of the service.



Launching OpenOCR on a Docker PAAS

OpenOCR can easily run on any PAAS that supports Docker containers. Here are the instructions for a few that have already been tested:

If your preferred PAAS isn't listed, please open a Github issue to request instructions.

Launching OpenOCR on Ubuntu 14.04

OpenOCR can be launched on anything that supports Docker, such as Ubuntu 14.04.

Here's how to install it from scratch and verify that it's working correctly.

Install Docker

See Installing Docker on Ubuntu instructions.

Find out your host address

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:43:40:c7
          inet addr:  Bcast:  Mask:

The ip address will be used as the RABBITMQ_HOST env variable below.

Launch docker images

Here's how to launch the docker images needed for OpenOCR.

$ curl -O
$ export RABBITMQ_HOST= RABBITMQ_PASS=supersecret2 HTTP_PORT=8080
$ chmod +x
$ ./

This will start three docker instances:

You are now ready to decode images → text via your REST API.

Test the REST API


$ curl -X POST -H "Content-Type: application/json" -d '{"img_url":"","engine":"tesseract"}'$HTTP_PORT/ocr


It will return the decoded text for the test image:

< HTTP/1.1 200 OK
< Date: Tue, 13 May 2014 16:18:50 GMT
< Content-Length: 283
< Content-Type: text/plain; charset=utf-8
You can create local variables for the pipelines within the template by
prefixing the variable name with a “$" sign. Variable names have to be
composed of alphanumeric characters and the underscore. In the example
below I have used a few variations that work for variable names.

The REST API also supports:

See the REST API docs and the Go REST client for details.



OpenOCR is Open Source and available under the Apache 2 License.