Skip to content

Use nginx-unprivileged as base image for web container#9719

Open
prskr wants to merge 1 commit intoente-io:mainfrom
prskr:feature/run-ente-web-rootless-in-docker
Open

Use nginx-unprivileged as base image for web container#9719
prskr wants to merge 1 commit intoente-io:mainfrom
prskr:feature/run-ente-web-rootless-in-docker

Conversation

@prskr
Copy link
Copy Markdown

@prskr prskr commented Mar 18, 2026

Description

It is strongly discouraged to run containers as root unless absolutely necessary. For nginx, there is an official -unprivileged image variant available for use.

This simplifies deploying Ente Web in Kubernetes environments with the Pod Security Admission controller enabled. Without explicit exclusion, the controller blocks the creation of containers or pods that run—or could run—as the root user.

The modifications applied to the Dockerfile now enable rootless container execution, though running the container with a read-only root filesystem remains challenging.

Tests

The build is working and I'm running the image in my private cluster for a few days already. If there are any further things you would like me to test / document, please let me know :)

This makes it easier to run Ente in Kubernetes environments with enabled
pod security admission.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 429cb6d9b9

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

COPY --from=builder /build/web/apps/share/out /out/share
COPY --from=builder /build/web/apps/embed/out /out/embed
COPY --chmod=755 <<EOF /docker-entrypoint.d/90-replace-ente-env.sh
sed -i'' "s#ENTE_API_ORIGIN_PLACEHOLDER#\$ENTE_API_ORIGIN#g" /etc/nginx/conf.d/default.conf
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Badge Make default.conf writable before the startup sed

After USER nginx, the image starts under the unprivileged account and the upstream entrypoint executes 90-replace-ente-env.sh before nginx. This sed -i edits /etc/nginx/conf.d/default.conf, but that file is created by COPY without --chown, so it stays root-owned (and its parent directory is not writable either). The first command in the script will therefore fail with Permission denied, causing the entrypoint to exit before nginx starts, which makes the new web image unusable with its default startup path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is a misunderstanding, this step is ONLY CREATING the script that will alter the /etc/nginx/conf.d/default.conf file. The file /etc/nginx/conf.d/default.conf itself is created in line 54 and following AFTER the USER nginx directive in line 45. So the user nginx is perfectly able to change the file /etc/nginx/conf.d/default.conf when the container is starting

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 18, 2026

CLA assistant check
All committers have signed the CLA.

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.

2 participants