Tools,

PaddleOCR in Docker, tested on arm64 and amd64

98.2%

of scan words, on arm64 and amd64

Get the Dockerfile

One Dockerfile for arm64 and amd64

Save the Dockerfile and paddle_ocr.py next to your book.pdf. Build once, then run:

docker build -t paddleocr .
docker run --rm -v "$PWD":/work -v paddlex:/root/.paddlex paddleocr --fast --threads 2

It writes book.txt next to the PDF. The first run downloads 139 MB of models into the paddlex volume.

Dockerfile paddle_ocr.py compose.yaml

Show the Dockerfile (16 lines)
# PaddleOCR 3.7 on the CPU, arm64 (Apple Silicon) and amd64 (brasspage.com/paddleocr-docker/, Nov 18, 2026)
FROM python:3.13-slim
ENV PIP_NO_CACHE_DIR=1 PADDLE_PDX_DISABLE_MODEL_SOURCE_CHECK=True
# On x86, paddlepaddle 3.3.1 with oneDNN stops with NotImplementedError (ConvertPirAttribute2RuntimeAttribute)
ENV PADDLE_PDX_ENABLE_MKLDNN_BYDEFAULT=False
# OpenCV and Paddle need these, or: ImportError: libGL.so.1 (or libgomp.so.1)
RUN apt-get update && apt-get install -y --no-install-recommends libgl1 libglib2.0-0 libgomp1 \
 && rm -rf /var/lib/apt/lists/*
# PyPI has no Linux arm64 wheel of paddlepaddle 3.3.1. Paddle's own index has both.
RUN pip install paddlepaddle==3.3.1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/ \
 && pip install paddleocr==3.7.0
# Only for the HTTP API (compose.yaml)
RUN paddlex --install serving
COPY paddle_ocr.py /app/paddle_ocr.py
WORKDIR /work
ENTRYPOINT ["python", "/app/paddle_ocr.py"]

paddle_ocr.py is the script of PaddleOCR on a Mac, unchanged. --fast turns off the page turn, unwarp and line turn models. On flat scans they cut letters.

Four errors, and how the Dockerfile fixes each

Each error on python:3.13-slim, before its fix
Error Seen on Fix in the Dockerfile
No matching distribution found for paddlepaddle==3.3.1 arm64 -i Paddle's own index
ImportError: libGL.so.1 arm64 libgl1 libglib2.0-0
ImportError: libgomp.so.1 amd64 libgomp1
NotImplementedError: (Unimplemented) ConvertPirAttribute2RuntimeAttribute amd64 PADDLE_PDX_ENABLE_MKLDNN_BYDEFAULT=False

PyPI has no Linux arm64 wheel of paddlepaddle 3.3.1. Without a pin, pip on arm64 quietly installs 3.2.2.

The last error is a oneDNN bug in paddlepaddle 3.3.1 on x86. It stopped on the first page. Open reports: Paddle #77340, PaddleOCR #18162.

No Python 3.14 yet

paddlepaddle 3.3.1 has wheels for Python 3.9 to 3.13, on PyPI and on Paddle's index. On python:3.14-slim, pip found none:

ERROR: Could not find a version that satisfies the requirement paddlepaddle==3.3.1 (from versions: none)

The image uses Python 3.13.

arm64 runs 1.4 to 1.5 times faster

11 pages, --fast, 2 CPUs, models already in the volume
Model arm64 amd64 (Rosetta) Scan words
Medium (default) 134 s 196 s 1,919 of 1,955
--size tiny 13 s 18 s 1,860 of 1,955

Both images wrote the same scan text, byte for byte, as our Mac install on November 12. The image is 386 MB compressed on arm64 (1.74 GB on disk), and 518 MB on amd64 (2.29 GB).

The HTTP API crashed on arm64

compose.yaml runs PaddleX's own server from the same image:

docker compose up -d
python3 -c 'import base64, json, sys; print(json.dumps({"file": base64.b64encode(open(sys.argv[1], "rb").read()).decode(), "fileType": 0, "useDocOrientationClassify": False, "useDocUnwarping": False, "useTextlineOrientation": False, "visualize": False}))' book.pdf \
  | curl -s -H "Content-Type: application/json" -d @- http://localhost:8080/ocr \
  | jq -r '[.result.ocrResults[].prunedResult.rec_texts | join("\n")] | join("\n\n")' > book.txt

On arm64 the server stopped on the first request, a PDF or a PNG, with Segmentation fault. So the file pins platform: linux/amd64.

On amd64 it worked: 53 s for one scan page with 2 CPUs. The command line read 11 pages in 196 s on the same image.

How I tested it
  • Docker Desktop 29.8.2 on an Apple Silicon Mac, 8 CPUs in its VM. amd64 ran under Rosetta. Each command line run got --cpus 2 and --threads 2. The API got cpus: 2 and PaddleX's default threads.
  • paddlepaddle 3.3.1, paddleocr 3.7.0, paddlex 3.7.2, Python 3.13.18, PP-OCRv6 models. The same versions as the Mac page, except Python 3.12 there.
  • File: the 11-page PDF of the Mac page, a typed cover and 10 proofread book scans with 1,955 true words. The 10 scan pages of each run had the same SHA-256 as the Mac run, so they keep its score.
  • Times count the whole docker run. One run each, while other jobs used the Mac.
  • The Mac run took 293 s for the same file. It ran at background priority, on the slow cores, so its time does not compare.
  • Not tested: a GPU, an x86 machine, the API with more CPUs.

No Docker at all: our Actor

No install. Our Actor reads scanned PDFs in the cloud, for $0.006 a scanned page.

curl -s -X POST "https://api.apify.com/v2/acts/brasspage~pdf-ocr-to-markdown/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"documentUrls": ["https://api.apify.com/v2/key-value-stores/sTnmNrGoSsi7tLQvs/records/anythingllm-mixed-11-pages.pdf"]}' \
  | jq -r '.[].markdown' > book.md

On this file on November 12, it found 1,874 of 1,955 scan words in 133 s. PaddleOCR medium found 1,919, tiny 1,860.

Try the Actor

Questions people ask

Is there an official PaddleOCR Docker image?

Not a current one. paddlecloud/paddleocr on Docker Hub stops at PaddleOCR 2.6, from June 2023, for amd64. paddlepaddle/paddle:3.3.1 has PaddlePaddle only, for amd64 only, at 1.8 GB compressed.

Does PaddleOCR run in Docker on an Apple Silicon Mac?

Yes, as an arm64 image, if paddlepaddle comes from Paddle's own index. It read 11 pages in 134 s with 2 CPUs.

Does PaddleOCR work with Python 3.14?

Not yet. paddlepaddle 3.3.1 has wheels for Python 3.9 to 3.13, on PyPI and on Paddle's index. Python 3.13 works.

Can I use a GPU in Docker?

We did not test it, as our Mac has no NVIDIA GPU. The paddlepaddle/paddle CUDA images are 12 to 18.6 GB. This Dockerfile installs the CPU build.

Does the container upload my files?

No. The first run downloads the models from Hugging Face into a volume. Then it reads your PDF on your own computer.