Setting ulimit

Is there any native way to set ulimit for a coreos build?
I’m investigating using it to run a docker application that requires a signicant amount of open files.
I know i can set the file limit in the container via --ulimit nofile=262144:262144 but my coreos image shows a file limit
open files (-n) 1024


Thanks Vladislav, is that applicable to coreos? that file (or any of the standard directories) doesn’t exist on the test instances that I have

I tried setting
cat /etc/systemd/system.conf

but ulimit -a still shows 1024 so i assume that coreos pulls that value from elsewhere

1 Like

I’ve just tried configuring Butane to create a systemoverrides bash file

    - path: /etc/
      mode: 0744
        inline: |
          echo '* soft nofile 4096' >> /etc/security/limits.conf
          echo '* hard nofile 8192' >> /etc/security/limits.conf
          echo 'root soft nofile 4096' >> /etc/security/limits.conf
          echo 'root hard nofile 8192' >> /etc/security/limits.conf

And then a oneshot systemd unit file

    - name: set-systemoverrides.service
      enabled: true
      contents: |
        Description=Setup system parameter overrides

        ExecStart=bash /etc/


It feels a bit hacky but seems to work ok

That is the soft limit.

But you have set the hard limit with DefaultLimitNOFILE=65536 I think.

You can see the hard limit with ulimit -aH.

Usually an app with set the soft limit higher when it runs.

One can see the options for ulimit by using man ulimit which brings up the man page for the bash built-ins, then search for ulimit.

ulimit -a displays all limits that are set; and as already mention ulinit -aH gives the hard limits.
for my user I see

open files                          (-n) 1024


open files                          (-n) 1048576


I think this can be improved. Ignition/Butane do support appending to a file:

    - path: /etc/security/limits.conf
      mode: 0644
        - inline: |
            * soft nofile 4096
            * hard nofile 8192
            root soft nofile 4096
            root hard nofile 8192

1 Like

That worked great thanks!

1 Like