Open abeltre1 opened 1 month ago
@abeltre1 can you try this with our non root image - it's built to solve this issue: https://github.com/BerriAI/litellm/pkgs/container/litellm-non_root
@abeltre1 can you try this with our non root image - it's built to solve this issue: https://github.com/BerriAI/litellm/pkgs/container/litellm-non_root
Hello @ishaan-jaff,
I switched to the non-root image as you suggested, but I encountered a PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.11/site-packages/prisma/schema.prisma'.
This type of permission issue is quite common in OpenShift due to its security model, which restricts write permissions for non-root users.
To address this, I modified the Dockerfile with the following workaround:
FROM ghcr.io/berriai/litellm-database:main-v1.43.18
USER 0
RUN chgrp -R 0 /usr/local/lib/python3.11/site-packages/prisma && \
chmod -R g=u /usr/local/lib/python3.11/site-packages/prisma && \
chmod -R +w /usr/local/lib/python3.11/site-packages/prisma
# Delete this file so it can be re-created with the correct permissions
# by whatever user OpenShift assigns at runtime.
RUN rm -rf /usr/local/lib/python3.11/site-packages/prisma/schema.prisma
ENTRYPOINT ["litellm"]
CMD ["--port", "4000"]
This workaround effectively resolves the issue. However, incorporating these changes into the upstream Litellm image could significantly benefit all users, especially those deploying in secured environments like OpenShift. It would enhance the out-of-the-box experience by ensuring compatibility with OpenShift's security policies without requiring manual adjustments.
Would it be possible for you to consider adding these adjustments to the Litellm upstream image? This change would not only streamline deployments in OpenShift but also align with best practices for container security by supporting non-root users.
Reference: Support arbitrary user ids
What happened?
Problem:
In this issue, the default
litellm
command within the LiteLLM container attempts to executeprisma generate
within a directory facing two significant challenges that must be addressed on OpenShift for the command to successfully write to the directory:/usr/local/lib/python3.11/site-packages/prisma/,
is mounted as read-only.schema.prisma
, already present at the target path, cannot be overwritten. This is due to the function callshutil.copy(data.schema_path, packaged_schema)
attempting to overwriteschema.prisma.
Solution:
/usr/local/lib/python3.11/site-packages/prisma/schema.prisma
.schema.prisma
file. This way we can executelitellm
command can executeprisma generate
without encountering issues.It is worth highlighting that OpenShift permissions are stricter security policies.
Relevant log output