When i include the following command in my Docker file, I'm getting an error. I am trying to create a docker file for creating my base image for Redis, and this command helps with redis performance.
RUN echo 4096 > /writable-proc/sys/net/core/somaxconn
The error i am getting when i try to build the docker file to create an image is:
/bin/sh: 1: cannot create /writable-proc/sys/net/core/somaxconn: Directory nonexistent
Any suggestions on how i can run this command? I would actually like to run the following commands in my Dockerfile:
RUN echo 4096 > /writable-proc/sys/net/core/somaxconn
RUN echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
RUN echo never > /sys/kernel/mm/transparent_hugepage/enabled
Below is the entire Docker file for my Redis image:
#Download base image ubuntu 16.04
FROM ubuntu:14.04
MAINTAINER George Chilumbu
ENV HOME /root
ENV DEBIAN_FRONTEND noninteractive
#ENV /writable-proc/sys/net/core/somaxconn /proc:/writable-proc
# Set the working directory to /app
WORKDIR ~/
# Redis Cache Server Tuning
RUN mkdir -p /writable-proc/sys/net/core/somaxconn
RUN echo 4096 > /writable-proc/sys/net/core/somaxconn
#RUN echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
#RUN echo never > /sys/kernel/mm/transparent_hugepage/enabled
# Install some necessary software/tools
RUN apt-get update && apt-get install -y \
wget \
vim \
unzip \
inetutils-ping \
inetutils-tools \
net-tools \
dnsutils \
software-properties-common \
python-software-properties \
ntp \
rsyslog \
curl
RUN add-apt-repository ppa:gaod/redis-server \
&& apt-get update \
&& apt-get install -y redis-server \
redis-sentinel \
&& rm /etc/redis/redis.conf \
&& rm /etc/redis/sentinel.conf
RUN mkdir -p /opt/redis/redis_dump
RUN chown redis:redis -R /opt/redis/redis_dump/