Pull the container image and read your first barcode label
QR Code AI publishes the open-source Barcode Scanner container image on the GitHub Container Registry (GHCR) and indexes it on Artifact Hub as a verified publisher. The CLI image packages qrscan for Linux AMD64 and ARM64: it reads mounted label files and prints a JSON report offline. A separate GHCR image offers a self-hosted HTTP service for services that send barcode images over HTTP.
Pull the container image and read the public sample
The first command downloads the public EAN-13 sample into the current directory. The docker commands pull the multi-platform GHCR CLI image and scan 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}'The run mounts the current directory read-only, drops every capability and disables the network. The jq filter keeps the first detection of the JSON report.
detections[0] is the first code of the report. If the label image also holds a QR code, the report lists the QR code first: select the barcode by its format instead, for example jq -r '.detections[] | select(.symbology == "ean13") | .content.text' for this EAN-13 sample.
qrscan has three profiles: full, the default, computes a scannability score for the first code of the report at full depth, fast computes it at reduced depth and frame only decodes.
This sample needs jq, a command-line JSON filter. In a pipeline the shell reports the exit code of jq, not of the scanner: to branch on the scanner’s exit code, write the report to a file first, as under “Save the JSON report on the host”, and read the exit code, or run the pipeline under set -o pipefail.
The commands in this guide are written for a POSIX shell such as bash or zsh.
The same container image also reads QR codes: see the QR Code Scanner Docker guide.
What you get
The container prints the same JSON report as the qrscan command-line program. For the public EAN-13 sample downloaded above, the first detection reads:
{
"symbology": "ean13",
"content": {
"text": "9506000134352",
"raw": "OTUwNjAwMDEzNDM1Mg==",
"charset": "utf8"
},
"payload": {
"kind": "gs1",
"elements": [
{
"ai": "01",
"value": "09506000134352"
}
],
"gtin": "09506000134352",
"conformant": true,
"issues": []
}
}symbology is the detected format, content.text the digits exactly as encoded, and payload their GS1 reading: Application Identifier 01 ("ai": "01") with the same number as a 14-digit GTIN, leading zero included.
The scanner’s published example report shows the same detection.
Save the JSON report on the host
To read your own label file, here inventory-label.png, put it in the current directory. Without a filter, qrscan prints the complete scan report as JSON. Redirect it to a file on the host: 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 report contains the value STOCK-4827 and its format.
To prepare that label file, create a test barcode with Barcode Generator using Code 128 and STOCK-4827. Save the PNG as inventory-label.png in the folder you mount.
The distribution guide documents published tags, digests and provenance verification.
The Barcode Scanner CLI guide lists every option.
