Barcode Scanner with Docker

Decode barcode label images inside a pinned container image. Feed identifiers and detected symbologies directly into your batch jobs and CI pipelines.

  • GHCR

    CLI container image

    Check pull command

Barcode Scanner Docker at a glance

  • Published on GHCR and Artifact Hub

    CLI + HTTP

  • Linux platforms

    AMD64 + ARM64

  • Runs fully offline without network

    Offline

  • Open-source licence

    MIT

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.

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}'

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:

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

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

Official container images and catalogues for Barcode Scanner

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

GitHub Container Registry (CLI)

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

Artifact Hub

Check the verified-publisher Artifact Hub catalogue entry to review 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 instead of launching a one-shot CLI container.

Step-by-step guide to running the Barcode Scanner container

Pull the GHCR image, mount your label directory read-only and capture the JSON output before updating another system.

  1. Step 1

    Pull the container image

    Fetch ghcr.io/qrcode-ai-com/qrcode-barcode-scanner by release tag or SHA-256 digest. Docker automatically pulls the Linux AMD64 or ARM64 build.

  2. Step 2

    Mount the intended label folder

    Bind-mount the host folder read-only and pass /input/inventory-label.png. Confirm non-root user 65532 has read permission on the file.

  3. Step 3

    Capture output and clean up

    Save stdout JSON to the host, add --rm to discard the stopped container, and distinguish scanner exit codes (0, 1, 2) from Docker errors (125 to 127).

Decoded barcode output: Code 128 and EAN-13 examples

The container outputs JSON detections carrying content.text and symbology (for example STOCK-4827 as Code 128 or 9506000134352 as EAN-13) without running a product lookup.

A saved Code 128 barcode image passes through a Docker container workflow to output the decoded value STOCK-4827.

Extract STOCK-4827 from inventory-label.png

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

Runtime flags, exit codes and supported barcode symbologies

Sandboxing and exit codes. Run with a read-only bind mount, all capabilities dropped and --network none; consult Docker’s run reference. Exit statuses mirror qrscan (0 decoded, 1 empty scan, 2 invalid input or mount), and a null frame score never equates to zero.

Symbologies and MCP alternative. A single image decodes 16 barcode formats (Code 128, EAN/UPC, ITF, Data Matrix, PDF417, Aztec, MaxiCode and others; GS1-128 maps to code128, ITF-14 to itf and ISBN to ean13) plus QR codes. For AI assistant tool calls, see the Barcode Scanner MCP Server guide.

Documentation and open-source licence. Check the distribution guide for current tags and digests, and visit the scanner repository for source code and the MIT licence.

CLI, Docker, MCP server, skill or SDK: choosing the right barcode scanner

Use the Docker image for containerised pipelines and consistent environments. For other needs, choose the matching guide.

Barcode Scanner

Scan a single code immediately in your browser with zero installation.

Open the barcode reader

Barcode Scanner CLI

Decode images inside a terminal script or CI job using one binary.

Explore Barcode Scanner CLI

Barcode Scanner Skills

Supply an AI agent with a consistent step-by-step image scanning workflow.

Explore Barcode Scanner Skills

Barcode Scanner SDK

Embed local scanning directly inside your app in your chosen language.

Explore the scanner SDK

Barcode Scanner Docker questions

Image reference, volume mounts, architectures, exit codes and licensing.

A barcode scanner Docker image packages a local barcode decoder together with its runtime as a portable container. QR Code AI’s open-source image wraps the qrscan binary: you mount the folder holding your label images, the container scans the requested file and prints a JSON report containing each decoded value and symbology. It provides no hosted endpoint, web UI or camera stream, and can access only the host files you mount.

Pull ghcr.io/qrcode-ai-com/qrcode-barcode-scanner with an explicit release tag listed on the GHCR package page, or pin its SHA-256 index digest for strict reproducibility. Keep the image tag or digest, CPU platform and run flags together in your pipeline config.

Mount the host folder holding your barcode image and pass its container-side path, such as /input/inventory-label.png. A read-only mount is sufficient. Because the container runs as a non-root user, ensure that user has read access to the file. Mounting a single directory keeps the rest of the host filesystem isolated.

No, the CLI image (ghcr.io/qrcode-ai-com/qrcode-barcode-scanner) executes qrscan on a mounted file and exits without opening a listening port. If your service needs a self-hosted HTTP barcode endpoint, pull the dedicated ghcr.io/qrcode-ai-com/qrcode-barcode-scanner-http container from GHCR.

The published GHCR image supports Linux AMD64 and ARM64; one multi-platform manifest covers both architectures and Docker automatically pulls the build matching your host.

Inspect both the exit status and the output report. Exit 0 indicates a detection and exit 1 denotes a valid scan with zero detections. Exit 2 signals invalid input or usage, such as a missing mount or unreadable file. Container-level failures come from Docker itself using exit codes 125 to 127 before qrscan runs: 125 when docker run fails, 126 when the command cannot be invoked and 127 when it is not found.

The container outputs the exact same JSON schema as the qrscan command-line utility, listing each detection with its string value and symbology. A Code 128 stock label holding STOCK-4827 returns STOCK-4827 as Code 128, while the public EAN-13 sample returns 9506000134352 together with a parsed GS1 payload carrying the 14-digit GTIN 09506000134352. Treat the value as an identifier rather than a product record: preserve every character including leading zeros, and query the system that issued it.

No. A retail barcode number or internal stock code is simply a lookup key for another database. Decoding it does not confirm an assigned GS1 identifier, retrieve a product title or current price, verify authenticity or certify label print quality. The report delivers the decoded value, its symbology and any parsed payload like a 14-digit GTIN; it never tells you who registered the number or what item it belongs to.

No. Reading an existing barcode image uses zero generation credits and activates no trial: it is completely independent of the QR Code AI creation service and its generation API. The creation service has free creation limits, a seven-day Premium trial triggered when you create your first dynamic QR code or Smart Link, and Premium requirements for ongoing use of affected features. Decoding a code never modifies what is encoded, and the scanner container is open source under the MIT licence.