Docker#
Prebuilt images with docTR installed are published on the GitHub Container Registry. They are based on CUDA 12.2 and ready for GPU inference.
Run an image#
docker run -it --gpus all ghcr.io/mindee/doctr:<tag> bash
Drop --gpus all to run on the CPU. For GPU support, your host needs:
an NVIDIA driver supporting CUDA 12.2 or newer, otherwise PyTorch cannot initialize the GPU;
the NVIDIA Container Toolkit so that Docker can access the GPU.
Build your own image#
The Dockerfile at the root of the repository accepts
build arguments to choose the Python version, the extras and the docTR version:
docker build -t doctr \
--build-arg FRAMEWORK="torch,viz,html,contrib" \
--build-arg PYTHON_VERSION=3.11.15 \
--build-arg DOCTR_VERSION=v1.1.0 \
.
Argument |
Default |
Description |
|---|---|---|
|
|
Extras to install, comma-separated (e.g. |
|
|
Python version, compiled from source |
|
|
Git branch, tag or commit of docTR to install |
Tip
Pretrained weights are downloaded at runtime. To avoid it, warm the cache when building the image, e.g. with
RUN python -c "from doctr.models import ocr_predictor; ocr_predictor(pretrained=True)", or mount a volume on
the cache directory (see Configuration).