Skip to content

Commit 761c033

Browse files
author
chendelin1982
committed
docs: add comprehensive multi-arch fix documentation
Add DOCKER-MULTIARCH-FIX.md covering: - Problem analysis (unknown/unknown platform) - Root cause (Atlas image pollution) - Solution (direct binary download) - Testing and verification steps - Action items for CI rebuild - Technical details and references This document serves as: - Troubleshooting guide - Historical record of the fix - Reference for similar issues
1 parent b7c6128 commit 761c033

File tree

1 file changed

+195
-0
lines changed

1 file changed

+195
-0
lines changed

docs/DOCKER-MULTIARCH-FIX.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# Docker Multi-Arch Build Fix - Complete Summary
2+
3+
## 🎯 Problem: unknown/unknown Platform in GHCR Manifest
4+
5+
### Symptoms
6+
```bash
7+
$ docker pull ghcr.io/websoft9/apprun-base:sha-e390123
8+
# Shows two platforms:
9+
# - linux/amd64 ✅
10+
# - unknown/unknown ❌
11+
```
12+
13+
When `docker-build.yml` tries to build for ARM64, it fails:
14+
```
15+
ERROR: no match for platform in manifest: not found
16+
```
17+
18+
---
19+
20+
## 🔍 Root Cause Analysis
21+
22+
### 1. Atlas Official Image Problem
23+
```bash
24+
$ docker manifest inspect arigaio/atlas:latest
25+
{
26+
"platform": {
27+
"architecture": "unknown",
28+
"os": "unknown"
29+
}
30+
}
31+
```
32+
33+
The Atlas official Docker image contains **malformed platform layers** with `unknown/unknown` metadata.
34+
35+
### 2. Dockerfile Inheritance
36+
```dockerfile
37+
# Old approach - inherits unknown platforms
38+
COPY --from=arigaio/atlas:latest /atlas /go/bin/atlas
39+
```
40+
41+
When we `COPY --from` the Atlas image, we **inherit its malformed manifest layers**, polluting our base image.
42+
43+
---
44+
45+
## ✅ Solution: Direct Binary Download
46+
47+
### Code Changes
48+
49+
**docker/Dockerfile.base**:
50+
```dockerfile
51+
# Before (❌ Polluted manifest)
52+
COPY --from=arigaio/atlas:latest /atlas /go/bin/atlas
53+
54+
# After (✅ Clean manifest)
55+
RUN ATLAS_ARCH=$(case ${TARGETARCH:-amd64} in \
56+
amd64) echo "amd64" ;; \
57+
arm64) echo "arm64" ;; \
58+
*) echo "amd64" ;; \
59+
esac) && \
60+
curl -sSL -o /go/bin/atlas \
61+
"https://release.ariga.io/atlas/atlas-linux-${ATLAS_ARCH}-latest" && \
62+
chmod +x /go/bin/atlas
63+
```
64+
65+
**Dependencies**: Added `curl` to Alpine packages.
66+
67+
---
68+
69+
## 🚀 Benefits
70+
71+
| Aspect | Old (Docker Image) | New (Direct Download) |
72+
|--------|-------------------|----------------------|
73+
| **Manifest** | ❌ Polluted with unknown/unknown | ✅ Clean: linux/amd64, linux/arm64 |
74+
| **Speed** | ~10s (pull image) | ~2s (download binary) |
75+
| **Size** | Inherits image layers | Only binary (~10MB) |
76+
| **Control** | Limited | Full architecture control |
77+
| **Reliability** | Dependent on Docker Hub | Direct from official CDN |
78+
79+
---
80+
81+
## 🧪 Testing & Verification
82+
83+
### Local Test
84+
```bash
85+
# Build and verify
86+
docker build -f docker/Dockerfile.base -t apprun-base:test .
87+
docker inspect apprun-base:test | jq '.[0].Architecture'
88+
# Output: "amd64" (no unknown)
89+
```
90+
91+
### CI Verification Script
92+
```bash
93+
./scripts/verify-manifest.sh ghcr.io/websoft9/apprun-base:latest
94+
```
95+
96+
### Multi-Arch Test
97+
```bash
98+
./scripts/test-multi-arch.sh
99+
```
100+
101+
---
102+
103+
## 📋 Action Items
104+
105+
### Immediate Steps (Required)
106+
107+
1. **✅ Code Fixed**: Direct binary download implemented
108+
2. **✅ Docs Updated**: docker/README.md explains the change
109+
3. **✅ Tests Added**: verify-manifest.sh for validation
110+
111+
### Next Steps (To Execute)
112+
113+
4. **🔄 Trigger Build Base Image**:
114+
- Go to: GitHub Actions > "Build Base Image"
115+
- Click: "Run workflow"
116+
- Select: ✅ Force rebuild
117+
- Wait: ~5-10 minutes
118+
119+
5. **✅ Verify Clean Manifest**:
120+
```bash
121+
./scripts/verify-manifest.sh ghcr.io/websoft9/apprun-base:latest
122+
```
123+
Should show only `linux/amd64` and `linux/arm64`
124+
125+
6. **🔄 Re-trigger Docker Build**:
126+
- Push code or manual trigger
127+
- Should now succeed for both architectures
128+
129+
---
130+
131+
## 📊 Technical Details
132+
133+
### Atlas Binary Sources
134+
- **AMD64**: https://release.ariga.io/atlas/atlas-linux-amd64-latest
135+
- **ARM64**: https://release.ariga.io/atlas/atlas-linux-arm64-latest
136+
- **Validated**: Both URLs return HTTP 200 with valid binaries
137+
138+
### Architecture Detection
139+
```bash
140+
TARGETARCH # Docker BuildKit automatic variable
141+
- In AMD64 build: TARGETARCH=amd64
142+
- In ARM64 build: TARGETARCH=arm64
143+
```
144+
145+
### Manifest Structure (After Fix)
146+
```json
147+
{
148+
"manifests": [
149+
{
150+
"platform": {
151+
"architecture": "amd64",
152+
"os": "linux"
153+
}
154+
},
155+
{
156+
"platform": {
157+
"architecture": "arm64",
158+
"os": "linux"
159+
}
160+
}
161+
]
162+
}
163+
```
164+
165+
---
166+
167+
## 🔗 Related Commits
168+
169+
```bash
170+
9795882 - fix(docker): eliminate unknown/unknown platform
171+
0373869 - docs(docker): document Atlas binary download method
172+
b7c6128 - test(docker): add manifest verification script
173+
```
174+
175+
---
176+
177+
## 📚 References
178+
179+
- **Atlas Releases**: https://release.ariga.io/atlas/
180+
- **Docker Multi-Arch**: https://docs.docker.com/build/building/multi-platform/
181+
- **GHCR Package**: https://github.com/Websoft9/apprun/pkgs/container/apprun-base
182+
183+
---
184+
185+
## ✅ Success Criteria
186+
187+
- [ ] Base image builds successfully for AMD64 and ARM64
188+
- [ ] Manifest contains only `linux/amd64` and `linux/arm64`
189+
- [ ] No `unknown/unknown` entries in GHCR
190+
- [ ] Application builds succeed using new base image
191+
- [ ] Atlas CLI works correctly in both architectures
192+
193+
---
194+
195+
**Status**: Code complete, awaiting CI rebuild to overwrite old manifest.

0 commit comments

Comments
 (0)