[Bug] Kata sandbox startup fails for non-root image users
- Dominant language
- Python
- Stars
- 485
- Forks
- 81
- Avg merge
- 16h 12m
- Merged PRs (30d)
- 8
Description
## Description
When a sandbox image specifies a non-root default user, such as `USER admin`,
the sandbox startup script fails when the Kata runtime is enabled.
`rock/rocklet/local_files/docker_run.sh` tries to create the Docker data-root directory:
```bash
mkdir -p /var/lib/docker
```
The non-root user does not have permission to create this directory. Because the
script enables `set -o errexit`, the permission error terminates the startup
script before Rocklet can start.
## Steps to reproduce
1. Prepare a sandbox image with a non-root default user:
```dockerfile
FROM python:3.11
RUN useradd -m admin
USER admin
```
2. Start a sandbox with this image and enable `use_kata_runtime`.
3. Observe the sandbox startup logs.
## Actual behavior
The startup script exits with a permission error:
```text
Kata runtime detected, setting up DinD disk...
mkdir: cannot create directory '/var/lib/docker': Permission denied
```
Rocklet is not started, and the sandbox fails its startup health check.
## Expected behavior
Before creating the Docker data-root directory, the startup script should check
whether the current user has permission to create it.
If the directory cannot be created:
- print a clear warning;
- skip Kata DinD disk initialization;
- continue starting Rocklet.
Writable custom Docker `data-root` paths, including multi-level paths, should
continue to work.
## Environment
- ROCK: `master` at `1faec82d3`
- Runtime: Kata
- Sandbox image default user: non-root
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with rock/rocklet/local_files/docker_run.sh and reproduce the Kata startup using an image whose default user is non-root. Check the permission failure around /var/lib/docker and custom multi-level data-root paths; done means an inaccessible path warns and skips DinD disk initialization while Rocklet starts, and writable paths still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, shell
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100