Oleg Dulin
Oleg Dulin

Reputation: 1447

How do I configure "ulimits" for a Docker container running in AWS ECS?

My Java application appears to be running out of "open files" limit when running in a Docker container in AWS ECS. Upon further investigation, I found that the open files limit defaults to 1024.

Typically, in Linux I would edit /etc/security/limits.conf. That does not appear to take effect when I modify that file in my Docker container.

I know I can also pass command line ulimit parameters to docker run as documented here. But I do not have direct access to the Docker command line in ECS. There's gotta be a way to do it via a Task definition. How do I accomplish this ?

Upvotes: 8

Views: 15091

Answers (2)

Austin Poole
Austin Poole

Reputation: 785

Via the Console navigate to the task definitions and under the "Resource Limits" section you can set the NOFILE soft/hard limits

enter image description here

For cloudformation you can set it via the task definition > Container Definition > Ulimits https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-ulimits

Be mindful of the fact that you should keep the hard limit below 1/10th of the afforded memory in Kilobytes to this task.

Upvotes: 1

Shibashis
Shibashis

Reputation: 8401

ECS task definition JSON allows you to set ulimits. The Ulimits on ecs task definition correspond to Ulimits in docker run.

Please refer to the following page for more information: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html

Upvotes: 17

Related Questions