fred00
fred00

Reputation: 611

docker-compose down failing: Too many open files

I'm using docker-compose in my production server. On my deploy process I run docker-compose down, deploy the application and run docker-compose up. However when I do docker-compose down it returns something like that:

ERROR: for ubuntu_php_run_1105  ('Connection aborted.', error(24, 'Too many open files'))

ERROR: for ubuntu_php_run_821  ('Connection aborted.', error(24, 'Too many open files'))

ERROR: for ubuntu_php_run_820  ('Connection aborted.', error(24, 'Too many open files'))

If I run this command manually more times eventually it succeeds but I need to fix it because this error makes my deploy process to fail.

Upvotes: 3

Views: 7776

Answers (2)

SangminKim
SangminKim

Reputation: 9136

It seems to exceed maximum open file descriptor of the container, tries to increase the maximum number of open file with nofile of ulimits.

For example,

ulimits:
  nofile:
    soft: 98304
    hard: 98304

For command line

--ulimit nofile=98304:98304

Upvotes: 6

fred00
fred00

Reputation: 611

I figured it out... I'm running some jobs in background to do it I used docker-compose run [service] [command], everytime it runs a new docker container is created and not killed. When I tried to docker-compose down there were a lot of containers and docker halted.

To solve I added --rm flag in docker-compose, this way when the command finished the conainer is removed:

docker-compose run --rm [service] [command]

Upvotes: 1

Related Questions