summaryrefslogtreecommitdiffstats
path: root/recipes-containers/vcontainer/files/vcontainer-init-common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-containers/vcontainer/files/vcontainer-init-common.sh')
-rwxr-xr-xrecipes-containers/vcontainer/files/vcontainer-init-common.sh26
1 files changed, 25 insertions, 1 deletions
diff --git a/recipes-containers/vcontainer/files/vcontainer-init-common.sh b/recipes-containers/vcontainer/files/vcontainer-init-common.sh
index 21bbe9db..738d0343 100755
--- a/recipes-containers/vcontainer/files/vcontainer-init-common.sh
+++ b/recipes-containers/vcontainer/files/vcontainer-init-common.sh
@@ -380,6 +380,25 @@ run_daemon_mode() {
380 log "Command needs input from shared directory" 380 log "Command needs input from shared directory"
381 fi 381 fi
382 382
383 # Check if this is a pull command that needs fallback handling
384 # (try registry first, fall back to Docker Hub)
385 USE_PULL_FALLBACK=false
386 if type is_pull_command >/dev/null 2>&1 && type execute_pull_with_fallback >/dev/null 2>&1; then
387 if is_pull_command "$CMD"; then
388 USE_PULL_FALLBACK=true
389 log "Using pull with registry fallback"
390 fi
391 fi
392
393 # Transform command if runtime provides a transform function
394 # (e.g., vdkr transforms unqualified images to use default registry)
395 # Note: Pull commands are NOT transformed - they use fallback logic
396 if [ "$USE_PULL_FALLBACK" != "true" ]; then
397 if type transform_docker_command >/dev/null 2>&1 && [ -n "$DOCKER_DEFAULT_REGISTRY" ]; then
398 CMD=$(transform_docker_command "$CMD")
399 fi
400 fi
401
383 log "Executing: $CMD" 402 log "Executing: $CMD"
384 403
385 # Verify shared directory has content if needed 404 # Verify shared directory has content if needed
@@ -403,7 +422,12 @@ run_daemon_mode() {
403 # Execute command 422 # Execute command
404 EXEC_OUTPUT="/tmp/daemon_output.txt" 423 EXEC_OUTPUT="/tmp/daemon_output.txt"
405 EXEC_EXIT_CODE=0 424 EXEC_EXIT_CODE=0
406 eval "$CMD" > "$EXEC_OUTPUT" 2>&1 || EXEC_EXIT_CODE=$? 425 if [ "$USE_PULL_FALLBACK" = "true" ]; then
426 # Pull commands use registry-first, Docker Hub fallback
427 execute_pull_with_fallback "$CMD" > "$EXEC_OUTPUT" 2>&1 || EXEC_EXIT_CODE=$?
428 else
429 eval "$CMD" > "$EXEC_OUTPUT" 2>&1 || EXEC_EXIT_CODE=$?
430 fi
407 431
408 # Clean up shared directory 432 # Clean up shared directory
409 if [ "$NEEDS_INPUT" = "true" ]; then 433 if [ "$NEEDS_INPUT" = "true" ]; then