5

The approach used to set the ulimit on a container does not work for services.

For containers, it's as simple as passing a ulimit parameter on the docker run command.

For services, is is possible on the command line? Ulimit is not recognized as a flag.

See here for a relevant question on containers (note: does not apply to services).

Community
  • 1
  • 1
Rubber Duck
  • 2,997
  • 2
  • 20
  • 25

1 Answers1

0

ulimit option is not available for docker services. You can instead create a configuration file (mylimits.conf) with the necessary configuration and add (or update) it to your service.

# docker config create mylimits.conf

# docker service create \
    --name nginx \
    --config source=mylimits.conf,target=/etc/security/limits.d/mylimits.conf \
    nginx:latest \
    sh -c "exec nginx -g 'daemon off;'"
Vijayendar Gururaja
  • 752
  • 1
  • 9
  • 16