Pull the container image and decode your first barcode label
QR Code AI publishes the open-source Barcode Scanner container image on GitHub Container Registry (GHCR) and lists it on Artifact Hub as a verified publisher. The CLI image bundles qrscan for Linux AMD64 and ARM64, reading mounted label files and outputting JSON completely offline. A companion GHCR image provides a self-hosted HTTP scanning endpoint for backend services that send images over HTTP.
Pull the image and test the public sample
The first command downloads the public EAN-13 sample into your working directory. The Docker commands then pull the multi-architecture GHCR CLI image and decode the mounted label offline.
curl -fsSL -o ean13.png \
https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/fixtures/symbology/ean13.png
image=ghcr.io/qrcode-ai-com/qrcode-barcode-scanner:0.12.2
docker pull "$image"
docker run --rm --network none --read-only --cap-drop ALL \
--mount type=bind,src="$PWD",dst=/input,readonly "$image" /input/ean13.png --budget-ms 0 \
| jq '.detections[0] | {symbology, content, payload}'This invocation mounts the working folder read-only, drops all Linux capabilities and disables networking. The jq filter extracts the first detection from the JSON report.
detections[0] refers to the first entry in the report. When a label image also includes a QR code, QR codes appear first in the array, so select the barcode by symbology instead, such as jq -r '.detections[] | select(.symbology == "ean13") | .content.text' for this EAN-13 sample.
qrscan supports three profiles: full (the default) calculates a full-depth scannability score for the first detected code, fast calculates a lighter score and frame performs decode-only scanning.
This snippet relies on jq to filter JSON on the command line. Remember that in a pipe the shell reports the exit status of jq rather than the scanner: to check the scanner’s exit code reliably, save the report to a file first as shown under “Write the JSON report to the host”, or run with set -o pipefail.
These commands are written for POSIX shells such as bash and zsh.
The same container image decodes QR codes too: refer to the QR Code Scanner Docker guide.
Expected output
The container prints the exact same JSON schema as the qrscan command-line utility. For the public EAN-13 sample fetched above, the first detection looks like this:
{
"symbology": "ean13",
"content": {
"text": "9506000134352",
"raw": "OTUwNjAwMDEzNDM1Mg==",
"charset": "utf8"
},
"payload": {
"kind": "gs1",
"elements": [
{
"ai": "01",
"value": "09506000134352"
}
],
"gtin": "09506000134352",
"conformant": true,
"issues": []
}
}Here symbology names the detected barcode format, content.text holds the exact encoded digits and payload supplies the parsed GS1 reading: Application Identifier 01 ("ai": "01") with the same code expressed as a 14-digit GTIN including its leading zero.
The scanner’s published sample report shows the exact same detection structure.
Write the JSON report to the host
To scan your own label image, such as inventory-label.png, place it in your working folder. Without a jq filter, qrscan outputs the complete JSON scan report to stdout. Redirect stdout to a host file so the container itself writes nothing.
docker run --rm --network none --read-only --cap-drop ALL \
--mount type=bind,src="$PWD",dst=/input,readonly \
ghcr.io/qrcode-ai-com/qrcode-barcode-scanner:0.12.2 /input/inventory-label.png --profile fast > report.jsonFor inventory-label.png, a Code 128 label, the JSON report captures STOCK-4827 along with its symbology.
To build that sample file yourself, create a test barcode with Barcode Generator using Code 128 and STOCK-4827, then save the PNG as inventory-label.png inside the folder you mount.
Consult the distribution guide for current tags, SHA-256 digests and provenance verification.
Refer to the Barcode Scanner CLI guide for the complete list of command flags.
