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

KarthikJ picture KarthikJ · Jul 25, 2014 · Viewed 26.9k times · Source

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.

Answer

KarthikJ picture KarthikJ · Jul 30, 2014

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.