Docker error while creating couchbase - ulimit: open files: cannot modify limit: Operation not permitted
Asked Answered
G

2

7

I am trying to create a docker image for Couchbase and i get the following error with the dockerfile on CentOS image.

# expose default port
EXPOSE 8091

ENV PATH $PATH:/opt/couchbase/bin

RUN cd /var/tmp &&\
    wget http://packages.couchbase.com/releases/2.5.0/couchbase-server-enterprise_2.5.0_x86_64.rpm &&\
    rpm -ivh couchbase-server-enterprise_2.5.0_x86_64.rpm &&\
    chkconfig couchbase-server on &&\
    service couchbase-server start

#add start script to the container
ADD start /start

#make the script executable
RUN chmod 0755 /start

EXPOSE 11211 11210 11209 4369 8092 18091 18092 11214 11215

#start mysql service and launch the command console
CMD ["/start"]

When building it, i am getting the following error ..

ulimit: open files: cannot modify limit: Operation not permitted
ulimit: max locked memory: cannot modify limit: Operation not permitted

I saw in a forum that we can set these values in docker.conf files. But i tried creating this file /etc/init/docker.conf and put the following lines in that file-

limit memlock unlimited unlimited limit nofile 262144

but still i get the same error.

If i follow the same steps manually on CentOS VM, it works. So i guess i need to set something on Docker CentOS image.

Gravity answered 25/7, 2014 at 17:43 Comment(0)
G
7

Resolved the issue by setting the ulimit on the Docker host using the following command:

ulimit -l unlimited
ulimit -n 10240 
ulimit -c unlimited

Then restart the Docker service on the CentOS. That fixed the issue since these values of the host will be inherited by the container.

Gravity answered 29/7, 2014 at 22:29 Comment(2)
on CentOS, add these commands to /etc/sysconfig/docker config fileSultana
These don't work on fargate/ecs -bash: ulimit: max locked memory: cannot modify limit: Operation not permittedHomogenetic
S
1

Only root can increase the hard upper limit, and you have to be logged in as root, sudo won't work.

su root
ulimit -n 10240
Sessile answered 1/3, 2015 at 22:2 Comment(1)
on RedHat I was able to change ulimit from root user onlyTrematode

© 2022 - 2024 — McMap. All rights reserved.