Redis-stack docker customize

121 views Asked by At

I want to customize the redis-stack using Dockerfile by adding config file but not work yet

FROM redis/redis-stack:latest

ENV PORT=6379
ENV RIPORT=8001

WORKDIR /db
COPY redis.conf ./redis-stack.conf

EXPOSE 6379 8001

CMD [ "redis-stack-server", "redis-stack.conf" ]

I can not access to redis insight port

1

There are 1 answers

0
Piroozeh On

It seems that you are trying to use the redis-stack image to run both Redis Stack server and RedisInsight, but you are not exposing the correct port for RedisInsight. The default port for RedisInsight is 8001, but you are exposing 8001 as the port for Redis Stack server. This may cause a conflict or a connection error when you try to access RedisInsight.

To fix this, you need to change the port mapping in your Dockerfile, so that Redis Stack server uses 6379 and RedisInsight uses 8001. For example, you can do something like this:

FROM redis/redis-stack:latest

ENV PORT=6379
ENV RIPORT=8001

WORKDIR /db
COPY redis.conf ./redis-stack.conf

EXPOSE 6379 8001

CMD [ "redis-stack-server", "redis-stack.conf", "--port", "$PORT", "--riport", "$RIPORT" ]

Actually change:

CMD [ "redis-stack-server", "redis-stack.conf" ]

To:

CMD [ "redis-stack-server", "redis-stack.conf", "--port", "$PORT", "--riport", "$RIPORT" ]

This way, you can access Redis Stack server on localhost:6379 and RedisInsight on localhost:8001.