Skip to content

docker: run rootless as the current user without requiring sudo - #1319

Merged
crazy-max merged 1 commit into
docker:mainfrom
crazy-max:fix-rootless-current-user
Sep 11, 2026
Merged

docker: run rootless as the current user without requiring sudo#1319
crazy-max merged 1 commit into
docker:mainfrom
crazy-max:fix-rootless-current-user

Conversation

@crazy-max

Copy link
Copy Markdown
Member

fixes docker/setup-docker-action#152

Rootless Docker now starts as the current user instead of switching to hard-coded UID 1001 through sudo. Cleanup also runs without sudo, using RootlessKit to remove files owned by subordinate UIDs. The GitHub-hosted AppArmor workaround is best-effort, so it no longer blocks container jobs where sudo is unavailable.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max requested a review from vvoland September 11, 2026 08:43
@crazy-max
crazy-max marked this pull request as ready for review September 11, 2026 08:43
Comment thread src/docker/install.ts
await core.group('Docker daemon logs', async () => {
await Exec.exec('sudo', ['cat', path.join(this.runDir, 'dockerd.log')], {ignoreReturnCode: true});
const args = [path.join(this.runDir, 'dockerd.log')];
await Exec.exec(this.rootless ? 'cat' : 'sudo', this.rootless ? args : ['cat', ...args], {ignoreReturnCode: true});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will require a follow up in setup-docker-action to also pass rootless to new Install for the teardown:

https://github.com/docker/setup-docker-action/blob/77e84dbf09b47d1e29270283c22f16145aa85ca1/src/main.ts#L101-L104

(it's really fishy that we just don't use the same object for both though!)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I missed the separate construction in post. I'll pass the rootless input there when updating the toolkit dependency. Main and post run in separate processes, so we need to reconstruct the instance, but the teardown options should match.

@crazy-max
crazy-max merged commit 5d26f3d into docker:main Sep 11, 2026
219 of 220 checks passed
@crazy-max
crazy-max deleted the fix-rootless-current-user branch September 11, 2026 10:10
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.

rootless still requires sudo

2 participants