Skip to content

Commit 6c37d60

Browse files
committed
Update containerization with base image + arch sections
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent c7f989f commit 6c37d60

File tree

1 file changed

+63
-11
lines changed

1 file changed

+63
-11
lines changed

_posts/2025-11-20-containerizing-applications.md

Lines changed: 63 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: From Embedded App to Container
33
author: troglobit
44
date: 2025-11-20 10:00:00 +0100
5+
last_modified_at: 2025-11-21 05:37:00 +0100
56
categories: [howto]
67
tags: [containers, docker, podman, embedded, migration]
78
---
@@ -140,6 +141,68 @@ You have two options for creating container images:
140141
1. **Build elsewhere, run on Infix** - recommended for most users
141142
2. **Build directly on Infix** - useful for prototyping
142143

144+
### Choosing a Base Image
145+
146+
Before creating your container, consider which base image to use:
147+
148+
**Alpine Linux** (used in our examples):
149+
- Minimal size (~5 MB base image)
150+
- Uses musl libc instead of glibc
151+
- Fast package installation with `apk`
152+
- **Limitation:** Not 100% compatible with glibc - some applications built for
153+
standard Linux distributions may not work
154+
- **Best for:** New applications, Python/Go/Rust apps, size-critical deployments
155+
156+
**Debian/Ubuntu:**
157+
- Uses standard glibc (better compatibility)
158+
- Larger base image (~50-100 MB)
159+
- Familiar `apt` package manager
160+
- **Best for:** Existing applications, binary compatibility requirements, complex
161+
dependencies
162+
163+
**Example alternatives:**
164+
165+
```dockerfile
166+
FROM debian:bookworm-slim # Debian 12 (minimal)
167+
FROM ubuntu:22.04 # Ubuntu LTS
168+
FROM python:3.11 # Python on Debian (larger but more compatible)
169+
```
170+
171+
> If you're migrating an existing application from Raspberry Pi OS, Debian, or
172+
> Ubuntu, starting with a Debian-based image often saves troubleshooting time.
173+
{: .prompt-tip }
174+
175+
### Cross-Architecture Considerations
176+
177+
Many developers build on x86_64 (amd64) workstations but deploy to ARM devices.
178+
Here's what you need to know:
179+
180+
**Architecture matching:** Your Infix device might run:
181+
- `aarch64` (ARM 64-bit) - Raspberry Pi 4/5, most modern ARM devices
182+
- `armv7l` (ARM 32-bit) - Older Raspberry Pi models
183+
- `x86_64` (amd64) - PC-based systems
184+
185+
**Build strategies:**
186+
187+
1. **Multi-architecture builds** (recommended for distribution):
188+
```console
189+
$ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
190+
-t myapp/temp-monitor:v1.0 --push .
191+
```
192+
193+
2. **Target-specific builds** (simplest for single deployment):
194+
```console
195+
$ docker build --platform linux/arm64 -t myapp/temp-monitor:v1.0 .
196+
```
197+
198+
3. **Native builds** (build directly on target architecture)
199+
200+
**Important notes:**
201+
- Pure interpreted languages (Python, Ruby) work across architectures
202+
- Compiled code must match the target architecture
203+
- Pre-built binaries in your container must be for the target architecture
204+
- Cross-compilation may require QEMU emulation (slower builds)
205+
143206
### Option 1: Build on Your Development Machine
144207

145208
Create a `Containerfile` (or `Dockerfile`) in your project directory:
@@ -510,17 +573,6 @@ admin@infix:/config/container/temp-monitor/mount/i2c/> set target /dev/i2c-1
510573
admin@infix:/config/container/temp-monitor/mount/i2c/> set read-only false
511574
```
512575

513-
### Multi-Architecture Support
514-
515-
Build for multiple CPU architectures:
516-
517-
```console
518-
$ docker build --platform linux/amd64,linux/arm64,linux/arm/v7 \
519-
-t ghcr.io/username/temp-monitor:v1.0 .
520-
```
521-
522-
Infix automatically pulls the correct architecture.
523-
524576
### Running Multiple Instances
525577

526578
Need to run multiple copies with different configurations?

0 commit comments

Comments
 (0)