signalfx / maestro-ng

Orchestration of Docker-based, multi-host environments
https://signalfx.com
Apache License 2.0
683 stars 83 forks source link

Added ability to set container ulimit. #173

Closed zsuzhengdu closed 8 years ago

zsuzhengdu commented 8 years ago

PR for https://github.com/signalfx/maestro-ng/issues/161

iangkent commented 8 years ago

+1

mpetazzoni commented 8 years ago

Thanks for the contribution! Can you also provide a unit test for this?

mpetazzoni commented 8 years ago

Thanks. Do we care about validating the name of the limits? Is there a known set of valid limit names?

zsuzhengdu commented 8 years ago

We do not need worry about validating the name of limits, 'docker' engine will do. If an invalid type is provided, following error will be threw out with input

ulimits:
  kobe: 65535
  File "/usr/lib/python2.7/site-packages/docker/api/container.py", line 368, in start
    self._raise_for_status(res)
  File "/usr/lib/python2.7/site-packages/docker/client.py", line 174, in _raise_for_status
    raise errors.APIError(e, response, explanation=explanation)
APIError: 500 Server Error: Internal Server Error ("{"message":"oci runtime error: Wrong rlimit value: RLIMIT_KOBE"}")

Here is a list of 'supported' names. https://github.com/docker/docker/blob/1c32bed48c160342871d4f1470dd4d62b4baa9a5/vendor/src/github.com/docker/go-units/ulimit.go#L23

mpetazzoni commented 8 years ago

Thanks!

zsuzhengdu commented 8 years ago

Thank you for your insightful code sample and comments!