Skip to content

Commit 313470a

Browse files
committed
Add minimal Docker platform bug repro workflow
1 parent a5e81cb commit 313470a

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Docker Platform Bug Repro
2+
3+
on:
4+
push:
5+
branches:
6+
- 'chrmarti/**'
7+
8+
jobs:
9+
repro:
10+
name: Platform Bug Repro
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Update Docker
14+
run: |
15+
sudo install -m 0755 -d /etc/apt/keyrings
16+
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
17+
sudo chmod a+r /etc/apt/keyrings/docker.asc
18+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
19+
sudo apt-get update
20+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin
21+
- name: Setup
22+
run: |
23+
docker version
24+
docker info | grep -E "Storage Driver|driver-type"
25+
docker run --privileged --rm tonistiigi/binfmt --install all
26+
- name: Build with platform in Dockerfile only
27+
run: |
28+
dir=$(mktemp -d)
29+
echo 'FROM --platform=linux/arm64 debian:latest' > "$dir/Dockerfile"
30+
docker buildx build --load -t test-arm64-in-dockerfile "$dir"
31+
- name: Inspect manifest list (Dockerfile platform)
32+
run: |
33+
docker image inspect test-arm64-in-dockerfile --format '{{.Architecture}}'
34+
digest=$(docker image inspect test-arm64-in-dockerfile --format '{{.Id}}')
35+
docker save test-arm64-in-dockerfile | tar -xO blobs/sha256/${digest#sha256:} | python3 -c "
36+
import sys, json
37+
data = json.load(sys.stdin)
38+
if 'manifests' in data:
39+
print('Manifest list found:')
40+
for m in data['manifests']:
41+
p = m.get('platform', {})
42+
t = m.get('annotations', {}).get('vnd.docker.reference.type', 'image')
43+
print(f' type={t} arch={p.get(\"architecture\")} os={p.get(\"os\")} variant={p.get(\"variant\", \"\")}')
44+
else:
45+
print('No manifest list (single manifest)')
46+
"
47+
- name: Build using that image as base with --platform linux/arm64
48+
run: |
49+
dir=$(mktemp -d)
50+
echo 'FROM test-arm64-in-dockerfile' > "$dir/Dockerfile"
51+
echo "Expecting this to fail due to manifest list platform mismatch..."
52+
if docker build --platform linux/arm64 -t test-arm64-rebuild "$dir" 2>&1; then
53+
echo "BUILD SUCCEEDED (bug may be fixed)"
54+
else
55+
echo "BUILD FAILED (bug confirmed)"
56+
fi
57+
- name: Build with --platform on CLI
58+
run: |
59+
dir=$(mktemp -d)
60+
echo 'FROM debian:latest' > "$dir/Dockerfile"
61+
docker buildx build --load --platform linux/arm64 -t test-arm64-on-cli "$dir"
62+
- name: Inspect manifest list (CLI platform)
63+
run: |
64+
docker image inspect test-arm64-on-cli --format '{{.Architecture}}'
65+
digest=$(docker image inspect test-arm64-on-cli --format '{{.Id}}')
66+
docker save test-arm64-on-cli | tar -xO blobs/sha256/${digest#sha256:} | python3 -c "
67+
import sys, json
68+
data = json.load(sys.stdin)
69+
if 'manifests' in data:
70+
print('Manifest list found:')
71+
for m in data['manifests']:
72+
p = m.get('platform', {})
73+
t = m.get('annotations', {}).get('vnd.docker.reference.type', 'image')
74+
print(f' type={t} arch={p.get(\"architecture\")} os={p.get(\"os\")} variant={p.get(\"variant\", \"\")}')
75+
else:
76+
print('No manifest list (single manifest)')
77+
"
78+
- name: Build using CLI-platform image with --platform linux/arm64
79+
run: |
80+
dir=$(mktemp -d)
81+
echo 'FROM test-arm64-on-cli' > "$dir/Dockerfile"
82+
if docker build --platform linux/arm64 -t test-arm64-on-cli-rebuild "$dir" 2>&1; then
83+
echo "BUILD SUCCEEDED (expected)"
84+
else
85+
echo "BUILD FAILED (unexpected)"
86+
fi

0 commit comments

Comments
 (0)