Skip to content

Dockerfile best practice: specify non-root USER in custom tool example Dockerfile #5048

Description

@neubig

Context

The Dockerfile at examples/02_remote_agent_server/06_custom_tool/Dockerfile does not currently specify a USER directive, so the container runs as root by default.

Best practice

It is a Docker best practice to run containers as a non-root user. Adding a USER directive with a non-root user avoids unnecessary privilege and follows community conventions for well-formed Dockerfiles.

Suggested change

Add a non-root user to the Dockerfile, e.g.:

RUN useradd -m appuser
USER appuser

Or use an existing non-root user if one is already created in the base image.

Acceptance criteria

  • Dockerfile includes a USER directive with a non-root user
  • Container still builds and runs correctly

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions