Skip to content

Conversation

@JasonShigemura
Copy link
Contributor

Configure Docker image to run as 'appuser' instead of root.

Description

This PR addresses a critical security concern by configuring the Docker container to run the application as a dedicated, unprivileged non-root user ('appuser') instead of the default 'root' user.

Running containers as root is against security best practices as it increases the potential impact if the application process is compromised. Switching to a non-root user limits the process's privileges within the container.

This change aligns with Docker security recommendations and hardens the deployment environment.

Changes Made

  • Added instructions in the release stage of the Dockerfile to:
    • Create a new group (appgroup) and user (appuser).
    • Change ownership of the /app directory to appuser:appgroup.
  • Added the USER appuser instruction before the ENTRYPOINT to switch to the non-root user.

Related Issues/PRs

Checklist

  • Dockerfile modified to add and use a non-root user.
  • Docker image built and tested locally (docker build .)

Configure Docker image to run as 'appuser' instead of root.
@eucyt eucyt requested a review from a team May 8, 2025 08:34
Copy link
Contributor

@eucyt eucyt left a comment

Choose a reason for hiding this comment

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

@JasonShigemura
Sorry to late review
LGTM

@eucyt eucyt enabled auto-merge May 19, 2025 07:54
@eucyt eucyt added this pull request to the merge queue May 19, 2025
Merged via the queue into line:main with commit e76b340 May 19, 2025
5 checks passed
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