Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 752
cucucool Avatar asked Jul 25 '14 17:07

cucucool


2 Answers

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.

like image 126
cucucool Avatar answered Sep 20 '22 14:09

cucucool


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
like image 43
blented Avatar answered Sep 24 '22 14:09

blented