IMD SolutionComputing LibraryShop main store

Explainer

ctrlX Container Engine Docker image snap structure and build files

Edge computing and IIoT Published 9 min read By IMD Solution engineering team

Short answer

A ctrlX Container Engine snap is an image-provider package that delivers a pre-exported OCI Docker image archive, a docker-compose.yml definition, and an optional package-manifest.json UI configuration to ctrlX OS. To build one on an Ubuntu 22 host with Docker Engine, configure snapcraft.yaml and docker-compose.yml for your target architecture (amd64 or arm64), skip install-dotnet-sdk.sh because it applies only to .NET builds, and edit the YAML files with any plain-text editor.

A monitor listing six software containers with their state, ports and processor load, beside a keyboard, a small fanless edge computer and three stacked coloured blocks
On this page
  1. How a ctrlX Container Engine image-provider snap works
  2. Required build files and directory layout
  3. Exporting an OCI image archive for the target architecture
  4. Configuring docker-compose.yml and persistent storage
  5. Choosing the build environment and CI workflow
  6. Packaging a dual-architecture container snap from an Ubuntu 22 VM
  7. Comparing ctrlX container snaps with Siemens Industrial Edge
  8. Questions asked

Packaging a Docker image for ctrlX Container Engine requires building an Ubuntu core22 image-provider snap that bundles an exported Open Container Initiative (OCI) container archive, a docker-compose.yml service definition, and an optional package-manifest.json web UI file under a layout controlled by snap/snapcraft.yaml. Once your Docker image builds on an Ubuntu 22 host running Docker Engine, skip install-dotnet-sdk.sh—that script only prepares a .NET development toolchain and plays no part in container snap packaging. You also do not need VS Code; any plain-text editor that writes clean YAML and JSON files works for configuring the packaging files before running Snapcraft.

How a ctrlX Container Engine image-provider snap works #

In ctrlX OS, the container runtime lives inside the dedicated ctrlX Container Engine application rather than inside your own snap. Your snap package operates strictly as an image provider: it delivers a pre-exported container image tarball (image.tar.gz) along with a Compose file telling Container Engine which image tag to start and where to mount persistent data. Because Docker Engine has already assembled the application filesystem inside that image, Snapcraft does not compile your application code or bundle a container runtime inside the snap.

That division of roles removes two common false starts when moving from a finished Docker image to a ctrlX snap. First, language setup scripts in the Bosch Rexroth ctrlX AUTOMATION SDK such as install-dotnet-sdk.sh configure toolchains for native .NET snap builds and do nothing for container image-provider snaps. Second, producing a .snap package proves only that Snapcraft staged the declared files and metadata; proving runtime startup, volume mounting, and network reachability requires deploying the snap alongside ctrlX Container Engine on ctrlX COREvirtual or a physical ctrlX CORE X3/X7 controller.

Required build files and directory layout #

The Bosch Rexroth ctrlX AUTOMATION SDK repository organizes container snap projects under its samples-snap templates into a structured layout that separates image builds, runtime orchestration, snap metadata, and optional web UI registration:

Path in project tree Requirement Role in packaging and runtime
docker/amd64 and docker/arm64 Required per target architecture Hold architecture-specific Dockerfiles targeting ctrlX COREvirtual (amd64) and ctrlX CORE X3/X7 (arm64)
image.tar.gz Required Offline-exported OCI container image archive staged inside the snap for loading by ctrlX Container Engine
docker-compose/docker-compose.yml Required Declares container services, the pre-built image: reference, and persistent storage volumes
snap/snapcraft.yaml Required Snapcraft recipe targeting the core22 base that stages the archive, Compose file, and assets into an installable .snap
configs/package-assets/docker-mosquitto.package-manifest.json (example filename) Optional (web UI apps) Registers navigation entries and dashboard links in the ctrlX OS web interface for containerized web services
build_all.sh Recommended SDK wrapper script coordinating the Docker build, archive export, and Snapcraft packaging sequence

snap/snapcraft.yaml is the top-level packaging blueprint that binds those artifacts together. It sets snap metadata, targets the core22 base for the selected CPU architecture, stages the exported image archive and Compose file into the snap payload, and declares the interface dependencies that ctrlX Container Engine consumes at install time. Follow the guide on configuring snap dependencies for Container Engine to align those snap declarations with the Container Engine app on your controller.

Include a manifest file under configs/package-assets/—named after your application, using docker-mosquitto.package-manifest.json here as an illustrative filename—only when the container serves an HTTP dashboard or administration page that operators open from the ctrlX OS sidebar. Headless background containers such as brokers or collectors need no manifest file. When your app does ship a manifest, avoid native Windows snap builds outside Linux containers, because Windows build handling can drop manifest settings, as detailed in why a ctrlX snap build on Windows drops its package.manifest config.

Exporting an OCI image archive for the target architecture #

Plant-floor controllers rarely pull container images from public registries during commissioning, so ctrlX Container Engine loads an offline archive (image.tar.gz) staged inside the snap. Generate that archive from Docker Engine using docker save for an image already built locally, or docker buildx build --output type=oci when building directly to an OCI tarball. Both commands emit an on-disk layout defined by the Open Container Initiative (OCI) Image Layout Specification:

  • oci-layout: mandatory root marker file containing {"imageLayoutVersion": "1.0.0"} that identifies the archive as a compliant OCI layout.
  • index.json: entry-point image index referencing top-level manifests, including multi-architecture amd64 and arm64 indexes.
  • blobs/sha256/: content-addressable directory storing OCI image manifests (application/vnd.oci.image.manifest.v1+json), container configuration JSON files, and filesystem layer blobs.

The CPU architecture inside image.tar.gz must match the target controller processor before Snapcraft builds the snap. Build amd64 images for ctrlX COREvirtual simulation targets and arm64 images for physical ctrlX CORE X3/X7 controllers. Exporting an amd64 image built on an x86 Windows workstation VM and packaging it for an arm64 controller fails at runtime because Docker does not translate native binaries across processor architectures; see what Docker cannot do for an ARM edge gateway image for the architectural constraint.

Configuring docker-compose.yml and persistent storage #

Inside docker-compose/docker-compose.yml (the compose.yaml / docker-compose.yml schema defined by the Docker Compose Specification), top-level services and volumes blocks control how ctrlX Container Engine runs your exported image and preserves state across container restarts. Always reference the pre-exported image with image: rather than a controller-side build context. Compose supports short volume syntax (SOURCE:TARGET or SOURCE:TARGET:ACCESS_MODE)—such as the ctrlX persistent-storage path ${SNAP_DATA}/docker-volumes/docker-mosquitto/data:/mosquitto/data or a read-only mount /host/path:/container/path:ro—alongside long syntax specifying type (volume or bind), source, target, read_only, and bind.create_host_path.

Named volumes declared under top-level volumes are created automatically at startup and persist independently of individual container lifecycles, whereas bind mounts map explicit host directories into the container. When multiple containers need to exchange files through a shared volume on the same edge host, apply the volume-sharing rules in sharing data between Docker containers on an edge PC.

# Illustrative docker-compose/docker-compose.yml example
# Documented Compose schema keys: services, image, volumes, type, source, target, read_only
# Illustrative string values: mosquitto-broker (service name), local-mosquitto:1.0 (image tag)
services:
  mosquitto-broker:
    image: local-mosquitto:1.0
    volumes:
      - "${SNAP_DATA}/docker-volumes/docker-mosquitto/data:/mosquitto/data"
      - type: bind
        source: /host/path
        target: /container/path
        read_only: true

Validate both the Compose definition and the exported archive before running Snapcraft. Run Docker Compose's configuration-validation command against docker-compose/docker-compose.yml to verify schema syntax, confirm that the image: string matches the tag exported from Docker Engine, and list the root contents of image.tar.gz to verify that oci-layout, index.json, and blobs/sha256/ are present. After deploying the snap on ctrlX COREvirtual or a physical controller, confirm that container output lands inside the mapped ${SNAP_DATA}/docker-volumes/ directory on the host.

Choosing the build environment and CI workflow #

Four supported build workflows documented across the Bosch Rexroth ctrlX AUTOMATION SDK and ctrlx-actions repositories cover local workstations, ARM hardware, and automated release pipelines:

  • Native Ubuntu 22 VM with Docker Engine: If you already run Docker Engine inside an Ubuntu 22 VM on VMware over Windows, stay inside that Linux VM to install Snapcraft, place your project into the SDK's samples-snap directory tree, edit the YAML files in any plain-text editor, and invoke build_all.sh or Snapcraft directly.
  • Containerized Snapcraft on Windows or macOS: On workstations without native Snapcraft or a full Ubuntu VM, the ctrlX SDK ecosystem supports building core22 snaps inside Canonical's ghcr.io/canonical/snapcraft:8_core22 Docker image so packaging runs in a Linux core22 environment.
  • Native Ubuntu ARM64 build host: When targeting physical ctrlX CORE X3/X7 controllers without x86 emulation overhead, prepare an ARM64 Linux host by following the steps for configuring an Ubuntu ARM app build environment.
  • Automated multi-architecture CI/CD: Once snap/snapcraft.yaml and your architecture Dockerfiles work locally, move packaging to the official Bosch Rexroth ctrlx-actions GitHub Actions workflows to build both amd64 and arm64 snaps automatically without maintaining manual VMs.

Packaging a dual-architecture container snap from an Ubuntu 22 VM #

Inputs and sources

  • Build host: 1 Ubuntu 22 VM running Docker Engine, matching the core22 base documented in the Bosch Rexroth ctrlX AUTOMATION SDK repository.
  • Target platforms (Bosch Rexroth ctrlx-actions documentation): 2 CPU architectures—1 amd64 target (ctrlX COREvirtual) and 1 arm64 target (ctrlX CORE X3/X7).
  • Per-architecture build inputs (ctrlX AUTOMATION SDK samples-snap layout): 1 Dockerfile directory (docker/amd64 or docker/arm64) and 1 exported image.tar.gz archive per architecture.
  • Mandatory OCI root entries per exported archive (OCI Image Layout Specification): 3 entries (oci-layout, index.json, and blobs/sha256/).
  • Shared packaging files (ctrlX AUTOMATION SDK layout): 3 core control files (snap/snapcraft.yaml, docker-compose/docker-compose.yml, and build_all.sh) plus 1 web-UI manifest (configs/package-assets/docker-mosquitto.package-manifest.json, illustrative name) for a container exposing a ctrlX OS web dashboard.
  • Excluded non-container prerequisites: 0 .NET setup scripts (install-dotnet-sdk.sh) and 0 mandatory IDE installations.

Rule in words

Multiply the target architecture count by one Dockerfile directory and one exported OCI image archive per architecture to size the container build artifacts, and multiply the archive count by the three mandatory OCI root entries to set the required pre-packaging layout checks. Add the three core snap control files to one manifest file when the application provides a ctrlX OS web interface (or zero when headless). Each target architecture produces one installable .snap package.

Arithmetic

  • Target architectures: 1 amd64 target + 1 arm64 target = 2 architectures
  • Architecture Dockerfiles: 2 architectures x 1 Dockerfile/architecture = 2 Dockerfiles (docker/amd64 and docker/arm64)
  • Exported OCI archives: 2 architectures x 1 archive/architecture = 2 archives
  • Pre-packaging OCI root checks: 2 archives x 3 OCI entries/archive = 6 checks
  • Shared snap control files: 3 core files + 1 web-UI manifest = 4 control files (or 3 + 0 = 3 control files for a headless container)
  • Output snap packages: 2 architectures x 1 snap/architecture = 2 .snap packages

Result

Delivering a web-enabled container across virtual commissioning and physical hardware requires 2 architecture-specific Dockerfiles, 2 exported OCI archives passing 6 total root layout checks, 4 shared control files, and 0 .NET scripts or mandatory IDE installs, yielding 2 target-matched .snap packages.

Decision

  • At 1 target architecture (amd64 only for ctrlX COREvirtual, or arm64 only for ctrlX CORE X3/X7), maintain 1 Dockerfile directory and build 1 .snap package; at 2 architectures (virtual commissioning plus physical X3/X7 deployment), populate both docker/amd64 and docker/arm64 and automate dual builds via build_all.sh or ctrlx-actions.
  • If any exported archive shows fewer than 3 mandatory OCI root entries—or its index.json references an amd64 manifest for an arm64 controller—stop before running Snapcraft and re-export the image for the exact target architecture.
  • At 1 or more ctrlX OS web dashboards, include the package-manifest.json file and run Snapcraft on native Ubuntu 22 or inside ghcr.io/canonical/snapcraft:8_core22; at 0 web dashboards, omit configs/package-assets/ and ship only the 3 core control files.

Comparing ctrlX container snaps with Siemens Industrial Edge #

Engineers who maintain multi-vendor plant fleets often compare ctrlX Container Engine packaging against Siemens Industrial Edge. As shown in the Siemens Industrial Edge GitHub example templates, both ecosystems require pre-built container images and prohibit building images on the runtime controller, while differing in archive formats, Compose constraints, and OT platform integrations:

Packaging attribute ctrlX Container Engine (ctrlX OS) Siemens Industrial Edge
Distributable package format Ubuntu core22 .snap package .app / .ieapp archive
Packaging and management toolchain Snapcraft (snap/snapcraft.yaml), build_all.sh, ctrlx-actions Industrial Edge App Publisher (IEAP) and Industrial Edge Management (IEM)
Image sourcing constraint Pre-exported OCI archive (image.tar.gz) referenced by image: Pre-built image referenced by image: name:tag; service build: directives fail IEAP validation as unsupported
Documented Compose specifics Compose services and volumes (typically binding ${SNAP_DATA}/docker-volumes/...) Compose version "2.4" templates enforcing mem_limit (such as 300mb or 500mb) and mem_reservation
OT platform integration Web UI sidebar registration via package-manifest.json Native OT hooks including ie-databus MQTT variables and Layer 2 interfaces (zzz_layer2_net1)

When deploying the same containerized workload across both ecosystems, keep the application Dockerfile decoupled from the controller packaging wrapper. Build and verify the pre-built image first, reference it strictly via image: with no controller-side build: directive, and maintain thin platform wrappers—snap/snapcraft.yaml, ${SNAP_DATA} bind mounts, and optional package-manifest.json for ctrlX OS, versus Compose version "2.4" memory limits and IEAP metadata for Siemens Industrial Edge.

Questions asked

Can you convert an existing Docker image into a ctrlX snap without rewriting its Dockerfile?

Yes. If the image already targets the controller processor architecture and runs cleanly under Docker Compose, you can export it directly with docker save into an archive and reference that image tag in docker-compose.yml without modifying the original Dockerfile. Architecture-specific Dockerfiles under the amd64 and arm64 directories are only needed when you must rebuild the image for a different processor family or maintain reproducible multi-architecture builds in source control.

Why do exported container tarballs sometimes include a root manifest.json alongside index.json?

Export tools such as docker save often include a legacy root manifest.json file alongside the Open Container Initiative index.json entry point so older Docker daemons and import loaders can still read the archive without full OCI Image Layout support. Modern multi-architecture tooling reads index.json first to select the matching architecture manifest from the sha256 blobs directory, while legacy loaders fall back to manifest.json for backward compatibility.

Should persistent container data use a Compose named volume or a host bind mount in a ctrlX snap?

Use a host bind mount under the snap data directory when operators or backup tools need predictable host paths that survive snap updates and remain directly inspectable from the controller environment. Top-level named volumes declared in docker-compose.yml are created automatically at startup and persist independently of individual container lifecycles, which suits internal database files that no external tool reads directly, whereas bind mounts align with the standard ctrlX docker-volumes layout.

What happens when a container exceeds its memory limit in Siemens Industrial Edge?

In Siemens Industrial Edge applications using Compose version 2.4, exceeding the configured service memory limit triggers a kernel out-of-memory kill that terminates the container with exit code 137. Industrial Edge Management and the Industrial Edge Device enforce these per-service caps alongside app-level memory checks, whereas a ctrlX Container Engine snap does not automatically reject a Compose file for omitting memory caps unless you configure explicit runtime limits for your target environment.

Keep reading

  • Troubleshooting

    High CPU and memory with Node-RED containers on Balena Engine

    High CPU and memory on a controller running Node-RED under Balena Engine trace first to container state, not flows: repeated installs leave unused containers and OCI images that a Type 1 or Type 2 reset does not delete. Inventory everything the engine holds, prune only the unused artifacts, then baseline the load with flows stopped and OPC UA polling inactive.

    Edge computing and IIoT

  • Troubleshooting

    Fixing the Docker Compose logging options must be a mapping error

    The error means the options key under logging is written as a YAML list. Delete the dash and give max-size and max-file their own key-value lines, redeploy the stack, and inspect the recreated container to confirm the runtime received both limits.

    Edge computing and IIoT

  • Troubleshooting

    Docker OCI runtime create failed on SD card storage

    The runtime rejects the container's merged overlay2 path when it resolves through a symlink or against a mount that was not live when the daemon started. Set data-root in /etc/docker/daemon.json, stop the daemon, rsync the old tree to the card, and reboot so the SD card mounts before Docker starts.

    Edge computing and IIoT

Why a Node-RED node recipe builds but is missing from the image