docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.89k stars 5.21k forks source link

Support ulimit options #1322

Closed divideby0 closed 8 years ago

divideby0 commented 9 years ago

Now that Docker 1.6 supports ulimit options, it would be nice to have this as an option for containers managed by compose, similar to mem_limit, cpu_shares, etc.

janober commented 9 years ago

+1

aanand commented 9 years ago

Both are already supported: http://docs.docker.com/compose/yml/#working95dir-entrypoint-user-hostname-domainname-mem95limit-privileged-restart-stdin95open-tty-cpu95shares

divideby0 commented 9 years ago

To clarify, mem_limit and cpu_shares are supported but it doesn't appear that ulimit is supported yet. Ulimit options were only recently added in the Docker 1.6 engine:

https://blog.docker.com/2015/04/docker-release-1-6/

aanand commented 9 years ago

Sorry, I misread. Yes, ulimit support would be good. Looks like docker-py added support in https://github.com/docker/docker-py/pull/554, so it should be simple to do.

corbinu commented 9 years ago

+1 need for couchbase/server image

thaJeztah commented 9 years ago

Also worth noting that docker recently added support for ulimit to docker build as well. I wonder if compose should apply the limits both for build and run?

tpires commented 9 years ago

+1

lu4nm3 commented 9 years ago

+1

kfox1111 commented 9 years ago

+1

adrienkohlbecker commented 9 years ago

+1

crquan commented 9 years ago

+1

indigodp commented 9 years ago

+1

trukhinyuri commented 9 years ago

+1

Bondza commented 9 years ago

+1

crquan commented 9 years ago

+1

shanielh commented 9 years ago

+1

rschmukler commented 9 years ago

+1

KevinGreene commented 9 years ago

Working on this now. The ulimits argument in docker-py takes a list of dictionaries, with the key "name", optional keys "soft" and "hard", e.g. {'name': 'nofile', 'soft': 8096, 'hard': 16192}

The expected YAML entry in a Docker compose file for this would be:

ulimits:
  nofile:
    soft: 8096
    hard: 16192

Correct?

divideby0 commented 9 years ago

That sounds good to me, though I'm not certain if the existing YAML parser supports deeply nested values. If no, I think the alternative would also be acceptable:

ulimits:
  nofile: "8096:16912"

Note that the latter syntax more closely matches what's actually provided to the Docker daemon, for example:

docker -d --default-ulimit nofile=8096:16912

So that might be the path of least resistance.

dnephin commented 9 years ago

@KevinGreene that sounds good to me

Thanks for picking this up! Let me know if I can be of any help

KevinGreene commented 9 years ago

Working locally - Should have a PR ready tonight after some documentation fixes