Skip to content

Commit 3dc3b25

Browse files
eoinfennessyclaude
andcommitted
fix: run build container as host user for DinD compatibility
Use --userns=keep-id for podman and --user for docker instead of chmod a+w on build outputs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8ddadc6 commit 3dc3b25

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

build/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ set -euo pipefail
66
IMAGE="quay.io/opendatahub/odh-midstream-python-base-3-12:latest"
77
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
88

9+
# Run as host user so the container can write to the mounted volume.
910
if command -v podman &>/dev/null; then
1011
runtime=podman
12+
user_flag="--userns=keep-id"
1113
elif command -v docker &>/dev/null; then
1214
runtime=docker
15+
user_flag="--user=$(id -u):$(id -g)"
1316
else
1417
echo "Error: podman or docker required" >&2
1518
exit 1
1619
fi
1720

18-
# In DinD the container uid may differ from the host file owner,
19-
# so make build outputs writable by any user.
20-
chmod -R a+w "$REPO_ROOT/distribution" "$REPO_ROOT/Containerfile" 2>/dev/null || true
21-
2221
exec "$runtime" run --rm \
22+
"$user_flag" \
2323
-v "$REPO_ROOT:/workspace:z" \
2424
-w /workspace \
2525
"$IMAGE" \

0 commit comments

Comments
 (0)