OpenHands / OpenHands/software-agent-sdk
Dockerfile best practice: specify non-root USER in custom tool example Dockerfile
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 539
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 137
Description
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
USERdirective with a non-root user - Container still builds and runs correctly
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with examples/02_remote_agent_server/06_custom_tool/Dockerfile and inspect the base image for any existing non-root user. Add a non-root USER directive, then build and run the container to confirm it works and the acceptance criteria are met.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker
- Domain
- devops, security
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100