Skip to content

Support adjusting the number of file description #6707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/cortex/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ ARG TARGETARCH
RUN apk add --no-cache ca-certificates
COPY migrations /migrations/
COPY cortex-$TARGETARCH /bin/cortex
COPY run.sh /bin/run.sh
RUN chmod +x /bin/run.sh
EXPOSE 80
ENTRYPOINT [ "/bin/cortex" ]
ENTRYPOINT [ "/bin/run.sh" ]

ARG revision
LABEL org.opencontainers.image.title="cortex" \
Expand Down
11 changes: 11 additions & 0 deletions cmd/cortex/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
if [ -n "${CORTEX_ULIMIT_NOFILES:-}" ]; then
current_limit=$(ulimit -Hn)
if [ "$current_limit" != "unlimited" ]; then
if [ $CORTEX_ULIMIT_NOFILES -gt $current_limit ]; then
echo "Setting file description limit to $CORTEX_ULIMIT_NOFILES"
ulimit -Hn $CORTEX_ULIMIT_NOFILES
Copy link
Member

Choose a reason for hiding this comment

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

I understand modifying hard limits inside the container might solve the problem for some environments in which containers can modify the kernel limits. But I am not sure we should encourage that way of doing things.

I think we should document how to modify this in dockerd/containerd/k8s properly. It's not easy to do, as you have correctly reported.

fi
fi
fi
exec /bin/cortex "$@"
Loading