Skip to content

fix(rocklet): skip kata dind setup when docker data-root cannot be created - #1309

Merged
zhongwen666 merged 1 commit into
alibaba:masterfrom
hzy123662:fix/kata-nonroot-dind
Aug 6, 2026
Merged

fix(rocklet): skip kata dind setup when docker data-root cannot be created#1309
zhongwen666 merged 1 commit into
alibaba:masterfrom
hzy123662:fix/kata-nonroot-dind

Conversation

@hzy123662

@hzy123662 hzy123662 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • check permissions before creating the Docker data-root for Kata DinD;
  • log a clear warning and skip unavailable Kata DinD steps without returning early from setup_kata_dind;
  • preserve writable multi-level custom Docker data-root paths.

Problem

When a sandbox image uses a non-root default user, docker_run.sh cannot create /var/lib/docker.

Because the script enables set -o errexit, the permission error terminates the startup script before Rocklet starts.

Implementation

When the Docker data-root does not exist, walk upward to find the nearest existing path and verify that it is:

  • a directory;
  • writable;
  • executable/traversable.

If the directory cannot be created, the script only prints a warning. The DinD mkdir, mknod, and mount steps run only when the Docker data-root exists, so setup_kata_dind reaches its normal end and the subsequent Rocklet startup continues.

Test Plan

  • bash -n rock/rocklet/local_files/docker_run.sh
  • git diff --check
  • tests/unit/deployments/test_docker_env_injection.py: 8 passed
  • non-root + Kata + non-writable /var/lib/docker: warning emitted, directory not created, Rocklet startup marker observed, exit code 0
  • non-root + Kata + writable multi-level custom data-root: directory created and exit code 0
  • non-root + non-Kata: existing behavior unchanged
  • mount and mknod mocked during local permission tests

No automated Shell test file was added because existing changes to setup_kata_dind and docker_run.sh use script-level and integration validation rather than a dedicated Shell unit-test framework. The existing Docker environment-injection unit suite was run as regression coverage.

Real Kata runtime validation still needs to be performed on a Kata-enabled Linux worker.

refs #1308

@CLAassistant

CLAassistant commented Aug 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@hzy123662
hzy123662 force-pushed the fix/kata-nonroot-dind branch from bf06748 to 20269c8 Compare August 4, 2026 08:26
…eated

Non-root sandbox image users cannot create /var/lib/docker. With
set -o errexit, the startup script exits before rocklet starts.

Check the nearest existing parent of docker data-root and skip kata
DinD setup with a warning when directory creation is not permitted.
This preserves multi-level custom data-root paths rooted in writable
directories.
@hzy123662
hzy123662 force-pushed the fix/kata-nonroot-dind branch from 20269c8 to c90678f Compare August 5, 2026 02:22
@zhongwen666
zhongwen666 merged commit 740502d into alibaba:master Aug 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants