[PR #1202] [MERGED] feat: non root user container #1834

Closed
opened 2026-03-01 21:52:53 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/1202
Author: @ChristopherHX
Created: 6/6/2022
Status: Merged
Merged: 6/20/2022
Merged by: @cplee

Base: masterHead: christopherhx-non-root-container


📝 Commits (10+)

📊 Changes

4 files changed (+71 additions, -6 deletions)

View changed files

📝 pkg/container/docker_run.go (+62 -2)
📝 pkg/container/file_collector.go (+8 -3)
📝 pkg/runner/run_context.go (+0 -1)
📝 pkg/runner/runner_test.go (+1 -0)

📄 Description

What is changed

  • Call the id posix tool after starting any container to get the current container uid / gid, otherwise assume root without failing, fails for docker actions
  • Try to chown the workingdir to fix the owner of the folders, fails for docker actions
  • Add the uid and gid to the tar archive sent to docker, docker will write the files with the correct uid and gid
  • Finally try to chown the dstdir to fix the owner of the folders

Closes #398
Closes #935


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/1202 **Author:** [@ChristopherHX](https://github.com/ChristopherHX) **Created:** 6/6/2022 **Status:** ✅ Merged **Merged:** 6/20/2022 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `christopherhx-non-root-container` --- ### 📝 Commits (10+) - [`845c32b`](https://github.com/nektos/act/commit/845c32b6df5dce6654ebbc74d36b79b36fab9fc0) feat: non root user container - [`73dcc68`](https://github.com/nektos/act/commit/73dcc68a9596a5fc45e7deaa048e95a29530049a) Also chown WorkingDir - [`44a7db7`](https://github.com/nektos/act/commit/44a7db7180bd695e337116a3572e4289d4704ee0) . - [`250dfd4`](https://github.com/nektos/act/commit/250dfd4b62a59d5d60db7c9f6e7f108adf0ce8c6) . - [`c58c99c`](https://github.com/nektos/act/commit/c58c99c82a0add780f82a4c2ae033a218bd627ef) Update docker_run.go - [`7b1fa81`](https://github.com/nektos/act/commit/7b1fa8158d23a88e2242f76e523111d2360a1129) Add Test - [`2449215`](https://github.com/nektos/act/commit/2449215c1272ad748be12b57be0db614e0a10f03) Update runner_test.go - [`9933d4d`](https://github.com/nektos/act/commit/9933d4d527190c4af3a5e0651c1c30441dd627d7) Merge branch 'master' into christopherhx-non-root-container - [`98ecf9f`](https://github.com/nektos/act/commit/98ecf9fa47578d4749be8cd6c21c74983862ca16) Update docker_run.go - [`3513b4f`](https://github.com/nektos/act/commit/3513b4fc9f139debea64db5647cad0430ebadaa4) Apply suggestions from code review ### 📊 Changes **4 files changed** (+71 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `pkg/container/docker_run.go` (+62 -2) 📝 `pkg/container/file_collector.go` (+8 -3) 📝 `pkg/runner/run_context.go` (+0 -1) 📝 `pkg/runner/runner_test.go` (+1 -0) </details> ### 📄 Description What is changed - Call the `id` posix tool after starting any container to get the current container uid / gid, otherwise assume root without failing, **fails for docker actions** - Try to chown the workingdir to fix the owner of the folders, **fails for docker actions** - Add the uid and gid to the tar archive sent to docker, docker will write the files with the correct uid and gid - Finally try to chown the dstdir to fix the owner of the folders Closes #398 Closes #935 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:52:53 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1834
No description provided.