Problems with redis dockerfile startup scripts

the content of Dockerfile is as follows:

FROM centos
ADD redis-2.8.16.tar.gz /usr/local/rediscluster
ADD redis.conf /usr/local/rediscluster
ADD redis2.conf /usr/local/rediscluster
ADD redis3.conf /usr/local/rediscluster
ADD sentinel.conf /usr/local/rediscluster
ADD redis.sh /usr/local/rediscluster
ENV redispath /usr/local/rediscluster
WORKDIR $redispath
RUN \
    mkdir -p /var/redis/data &&\
   -sharp wget http://download.redis.io/redis-stable.tar.gz && \
    chmod +x /usr/local/rediscluster/redis.sh &&\
    cd /usr/local/rediscluster/redis-2.8.16 &&\
    yum -y install gcc automake autoconf libtool make &&\
    make &&\
    make install
-sharpRUN wget http://code.taobao.org/svn/openclouddb/downloads/old/MyCat-Sever-1.2/Mycat-server-1.2-GA-linux.tar.gz

EXPOSE 6379 6479 6579 26379
-sharpENTRYPOINT ["./redis.sh"]
CMD ["sh","redis.sh"]

the content of redis.sh is as follows

-sharp!/bin/sh
/usr/local/bin/redis-server  /usr/local/rediscluster/redis.conf &
/usr/local/bin/redis-server  /usr/local/rediscluster/redis2.conf &
/usr/local/bin/redis-server  /usr/local/rediscluster/redis3.conf &
/usr/local/bin/redis-server  /usr/local/rediscluster/sentinel.conf --sentinel &

description

  • I use redis2.8.16, to build a sentinel model of one master and two slaves. At present, the old project used by the company is 2.8.16
.

problems

  • when docker run-- name redis_v2-it bdf3e9b3e653, the newly created container is in exit status. It cannot be started using start, and there is no error message
.

clipboard.png

  • CMD ["sh","redis.sh"]

clipboard.png

  • I guess it"s the dockerfile startup script, but I can"t find the root cause after reading a lot of it.
Mar.10,2021

redis.sh the last redis-server does not use & .

every process in the script is executed in the background, so the bash execution exits in the end, and so does the container.

Menu