Setting `ulimit`

I’m trying to test a server with a lot of web sockets and I’m getting the error “Ranch acceptor reducing accept rate: out of file descriptors”

I’ve been trying to set ulimit -n ###### in various ways, but I see ulimit: open files: cannot modify limit: Operation not permitted in the logs. Is there an official way to set the file descriptor limit in a container?

(linking to this question to cross-link:How to settings maximal file descriptor e.g using ulimit ? )

Could you share you share what you’re willing to of your Dockerfile and entrypoint/command so we can get a closer look?

Yeah, for sure, thanks! Here’s a gist with those files: Dockerfile · GitHub

rel-overlays-bin-server is rel/overlays/bin/server (can’t have slashes in gist filenames)

I think it’s all the defaults generated for a Elixir app except for the addition of the ENTRYPOINT script and the adding of the ulimit to the server and migrate files.

It seems like this is probably due to USER nobody which is unlikely to have access to operate ulimit.

A quick fix would be to comment out the USER nobody line which should get you running as root at the time of entrypoint. Worth trying that out to see if it works for you.

root is slightly less problematic since these are VMs rather than containers, though not ideal.

If you wanted your process not running under root you could su nobody in the entrypoint. This isn’t perfect. If you did that you might need to create a user called nobody since USER nobody usually does that creation for you I believe.

I think that did it. At least I don’t see the permissions error anymore :smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.