Skip to content

feat(docker): run service containers as non-root user#4941

Merged
bobbai00 merged 4 commits intoapache:mainfrom
bobbai00:feat/non-root-service-user
May 5, 2026
Merged

feat(docker): run service containers as non-root user#4941
bobbai00 merged 4 commits intoapache:mainfrom
bobbai00:feat/non-root-service-user

Conversation

@bobbai00
Copy link
Copy Markdown
Contributor

@bobbai00 bobbai00 commented May 5, 2026

What changes were proposed in this PR?

Add a system user (UID/GID 1001, name texera) and a USER 1001:1001 directive at the end of every service runtime stage in bin/*.dockerfile. Aligns with Docker Hub's recommendation "Ensures the image specifies a non-root username (or UID) for the final stage."

  • 7 Debian-derived runtimes (eclipse-temurin:*-jammy): groupadd/useradd --system, chown -R texera:texera /texera, USER 1001:1001.
  • texera-web-application also chowns /frontend (frontend dist).
  • agent-service uses Alpine syntax (addgroup -S / adduser -S), chowns /app.

Any related issues, documentation, discussions?

Closes #4940.

How was this PR tested?

Tested locally by building the images

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7)

Add a system user (UID/GID 1001 "texera") and a USER directive at the
end of every service runtime stage so containers don't run as root.
Aligns with Kubernetes runAsNonRoot PSS guidance and clears the
Docker Hub "non-root user for the final stage" finding.

- 7 Debian-derived runtimes (eclipse-temurin:*-jammy):
    groupadd/useradd with --system, chown -R /texera, USER 1001:1001
- texera-web-application also chowns /frontend (frontend dist)
- agent-service uses Alpine syntax (addgroup -S / adduser -S),
  chown -R /app

Sidecars under bin/y-websocket-server/ and bin/pylsp/ are out of
scope; they have separate base-image issues tracked elsewhere.

Closes apache#4940
@bobbai00 bobbai00 added the release/v1.1.0-incubating back porting to release/v1.1.0-incubating label May 5, 2026
@bobbai00 bobbai00 requested a review from aglinxinyuan May 5, 2026 05:31
@bobbai00 bobbai00 merged commit b9c899f into apache:main May 5, 2026
18 checks passed
Yicong-Huang pushed a commit that referenced this pull request May 5, 2026
### What changes were proposed in this PR?

Add a system user (UID/GID `1001`, name `texera`) and a `USER 1001:1001`
directive at the end of every service runtime stage in
`bin/*.dockerfile`. Aligns with Docker Hub's recommendation *"Ensures
the image specifies a non-root username (or UID) for the final stage."*

- **7 Debian-derived runtimes** (`eclipse-temurin:*-jammy`):
`groupadd`/`useradd --system`, `chown -R texera:texera /texera`, `USER
1001:1001`.
- **`texera-web-application`** also chowns `/frontend` (frontend dist).
- **`agent-service`** uses Alpine syntax (`addgroup -S` / `adduser -S`),
chowns `/app`.

### Any related issues, documentation, discussions?

Closes #4940.

### How was this PR tested?

Tested locally by building the images

### Was this PR authored or co-authored using generative AI tooling?

(backported from commit b9c899f)

Generated-by: Claude Code (Opus 4.7)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Backport to release/v1.1.0-incubating succeeded as 7349698. Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev feature release/v1.1.0-incubating back porting to release/v1.1.0-incubating

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run service containers as non-root user

2 participants