简体   繁体   中英

Installing redis on docker container

I'm trying to install Redis in my node.js app contianer.

Container is throwing following error:

Starting redis-server: Starting nginx: nginx.
/etc/init.d/redis-server: 58: ulimit: error setting limit (Operation not permitted).

I have tried chmod 777 /etc/init.d/redis-server in my Dockerfile, but not helpful.

Below is my Dockerfile.

FROM node:latest
RUN apt-get update 
RUN apt-get install -y 
nginx
RUN apt-get install -y 
redis-server
WORKDIR /myproject

COPY server/package*.json 
./
RUN npm install

 COPY package*.json ./
RUN npm install
COPY . .
RUN npm run prod_build
RUN cp -r /myproject/dist/* 
/var/www/html

COPY Ngnix/sites- 
enabled/default 
 /etc/nginx/sites-enabled/ 
EXPOSE 5000
EXPOSE 80
EXPOSE 5001

CMD service nginx start \
 && service redis-server 
  start \
 && npm start server --prefix server

It is possible that the issue is because the user used in the node base image is non root. Try changing the user to root.

Also a better approach is separating the 2 containers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM