Barcode Scanner with Docker

Read barcode labels in a versioned container. Feed identifiers and detected formats into your jobs and pipelines.

  • GHCR

    CLI container image

    See the pull command

Barcode Scanner Docker at a glance

  • Published on GHCR and Artifact Hub

    CLI + HTTP

  • Linux platforms

    AMD64 + ARM64

  • Scans without network access

    Offline

  • Open-source license

    MIT

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.

Shell
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:

JSON
{
  "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.

Shell
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.json

For 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.

Published container images and catalogs for Barcode Scanner

Pull the MIT-licensed CLI or HTTP service image from GHCR, or verify release metadata on Artifact Hub.

GitHub Container Registry (CLI)

Pull ghcr.io/qrcode-ai-com/qrcode-barcode-scanner without an account for Linux AMD64 and ARM64. Pin a release tag or digest in your batch jobs and confirm user 65532 can read mounted label folders.

Artifact Hub

Review the verified-publisher Artifact Hub catalog entry to inspect available container tags, package metadata and security checks before pulling from GHCR.

HTTP Service Container (GHCR)

Deploy ghcr.io/qrcode-ai-com/qrcode-barcode-scanner-http when a warehouse or backend service sends barcode images over HTTP rather than invoking a one-shot CLI container.

How to run the Barcode Scanner container

Pull the GHCR image, mount your label folder read-only and capture the JSON report before calling another system.

  1. Step 1

    Pull the container image

    Pull ghcr.io/qrcode-ai-com/qrcode-barcode-scanner by release tag or SHA-256 digest. Docker automatically selects Linux AMD64 or ARM64.

  2. Step 2

    Expose the intended input

    Mount the host directory read-only and pass /input/inventory-label.png. Non-root user 65532 must have read access to the file.

  3. Step 3

    Collect the result and end the run

    Save stdout JSON, use --rm to remove the stopped container, and separate scanner exit codes (0/1/2) from Docker errors (125–127).

What a decoded barcode gives you: Code 128 and EAN-13 examples

The container prints JSON detections with content.text and symbology (such as STOCK-4827 as Code 128 or 9506000134352 as EAN-13) without product lookup.

An image file containing a Code 128 barcode connects through a Docker workflow to the decoded value STOCK-4827.

Read STOCK-4827 from inventory-label.png

For inventory-label.png, the container prints STOCK-4827 (Code 128). Preserve every character and leading zero for your inventory database.

Run options, exit codes and supported barcode formats

Isolation and exit codes. Run with a read-only mount, no capabilities and --network none; see Docker’s run reference. Exit codes match qrscan (0 decoded, 1 empty, 2 invalid input/mount), and a null frame score is never zero.

Formats and MCP alternative. One image decodes 16 barcode symbologies (Code 128, EAN/UPC, ITF, Data Matrix, PDF417, Aztec, MaxiCode; GS1-128 → code128, ITF-14 → itf, ISBN → ean13) plus QR. For AI tool calls, see the Barcode Scanner MCP Server guide.

Documentation and license. Read the distribution guide for tags and digests, and the scanner repository for source code and the MIT license.

CLI, Docker, MCP server, skill or SDK: which barcode scanner tool do you need?

The Docker image fits container jobs and identical environments. For another task, choose the matching guide.

Barcode Scanner

Read one code right now, in your browser. Nothing to install.

Open the barcode reader

Barcode Scanner CLI

Check images in a script or a CI job with one command.

Explore Barcode Scanner CLI

Barcode Scanner SDK

Build scanning into your own application, in your language.

Explore the scanner SDK

Barcode Scanner Docker questions

Image name, mounts, architectures, errors and licensing.

A barcode scanner Docker image packages a barcode-reading command and its runtime. QR Code AI’s open-source image packages the qrscan command: you mount the folder that holds your label files, the container reads the file you name and prints a JSON report with each value and its format. It provides no hosted endpoint, browser interface or webcam stream, and it reaches only the host files you mount.

Pull ghcr.io/qrcode-ai-com/qrcode-barcode-scanner with an explicit release tag from the GHCR package page (or pin its SHA-256 index digest for strict reproducibility). Keep the image reference, architecture and run options together in your job configuration.

Mount the host directory that holds the label file and pass its container-side path, for example /input/inventory-label.png. A read-only mount is enough. The container runs as a non-root user, so the file must be readable by that user. Mounting one directory does not expose the rest of the host filesystem.

The CLI image (ghcr.io/qrcode-ai-com/qrcode-barcode-scanner) does not: it runs qrscan on a mounted file and exits with no listening port. When you need a self-hosted HTTP barcode endpoint, pull the separate ghcr.io/qrcode-ai-com/qrcode-barcode-scanner-http container image from GHCR.

The published GHCR image supports Linux AMD64 and ARM64; one multi-platform index covers both and Docker selects the variant that matches the host.

Check the exit code and the report. Exit 0 means a detection and exit 1 a valid scan with no detections. Exit 2 means invalid input or usage, such as a missing mount or an unreadable file. Docker reports its own failures with exit codes 125 to 127, before the scanner runs: 125 when docker run itself fails, 126 when the command in the container cannot be invoked and 127 when it cannot be found.

The container prints the same JSON report as the qrscan command-line program: each detection with its value as text and its format. A Code 128 inventory label containing STOCK-4827 returns STOCK-4827 with the format Code 128; the public EAN-13 sample returns 9506000134352 and, as a parsed GS1 payload, the 14-digit GTIN 09506000134352. The value is an identifier, not a product record: keep every character, including leading zeros, and look it up in the system that assigned it.

No. A retail number or internal reference is a key for another system. Reading it does not establish an assigned GS1 identifier, retrieve a product name or current price, verify authenticity or certify printed-label quality. The report gives the decoded value, its format and a parsed payload such as a 14-digit GTIN; it does not say who the number was assigned to or what it identifies.

No. Decoding an existing image uses no generation credit and starts no trial: it is separate from the QR Code AI creation service and its generation API. That service has free creation limits, a seven-day Premium trial triggered by the first dynamic QR code or Smart Link, and Premium requirements for continued use of affected features. Reading a code never changes what is encoded in it. The scanner container is open source under the MIT license.