Skip to content

Run SDK Docker builds as the host user - #575

Open
jspaetzel wants to merge 2 commits into
mainfrom
fix/sdk-docker-file-ownership
Open

jspaetzel wants to merge 2 commits into
mainfrom
fix/sdk-docker-file-ownership

Conversation

@jspaetzel

@jspaetzel jspaetzel commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • SDK Docker builds bind-mount the checkout. On rootful Docker they ran as root, so generated files could not be replaced by a later git checkout.
  • bin/docker-user-args keeps root:root on rootless Docker (container root is already the host user) and uses the host uid/gid on rootful Docker. bin/docker-run applies that to every SDK docker run.
  • PHP, Node, Python, Ruby, Java, and .NET wrappers, run-build, and the sandbox scripts use it. Package caches are host directories under .docker so the non-root user can write them. bin/redoc-container still runs as root because nginx binds port 80 and does not write the checkout.

Test plan

  • On rootful Docker, bin/docker-run -v "$PWD:/work" -w /work alpine touch probe creates a file owned by the host user
  • ./generate-sdks -t php (and one other language) leaves the SDK tree writable by the developer
  • Rootless Docker still builds (docker-user-args prints --user root:root)
  • DOCKER_RUN_AS_ROOT=1 restores the old root behavior

Container root owns generated files on a normal Docker daemon, so a later checkout cannot replace them. Rootless Docker still runs as container root because that user is already the host user.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jspaetzel
jspaetzel marked this pull request as ready for review October 12, 2026 21:00
@jspaetzel
jspaetzel marked this pull request as draft October 12, 2026 21:09
Shared docker-run and php-in-docker wrappers replace the copied root invocations, and package caches live in host .docker directories so a non-root user can write them.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jspaetzel jspaetzel changed the title Run PHP SDK Docker builds as the host user Run SDK Docker builds as the host user Oct 12, 2026
@jspaetzel
jspaetzel marked this pull request as ready for review October 12, 2026 21:18
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.

1 participant