From 15d3c551a4532227ddd2e6f0fae189ba9bd9bdc7 Mon Sep 17 00:00:00 2001 From: "yangyufans@126.com" <> Date: Sat, 4 Oct 2025 22:09:44 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=9B=B4=E6=96=B0redis=207.4.6=208.2?= =?UTF-8?q?.2=202=E3=80=81=E4=BF=AE=E6=94=B9=E5=9F=BA=E7=A1=80=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- redis/7.4.6/Dockerfile | 40 +++++++++++++++++++++++++++++++++++++++ redis/7.4.6/start.sh | 8 ++++++++ redis/8.2.2/Dockerfile | 43 ++++++++++++++++++++++++++++++++++++++++++ redis/8.2.2/start.sh | 8 ++++++++ redis/README.md | 8 ++++---- 6 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 redis/7.4.6/Dockerfile create mode 100644 redis/7.4.6/start.sh create mode 100644 redis/8.2.2/Dockerfile create mode 100644 redis/8.2.2/start.sh diff --git a/README.md b/README.md index b1cc200..73640f4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ - **Hive**:2.3.3、3.0.0 - **Hexo**:静态博客部署 - **Nginx**:多个版本,包括 1.9.9、1.15.0、1.17.0、1.25.4、1.27.2、1.29.1 -- **Redis**:4.0.10、6.2.5、7.0.9、7.2.4 +- **Redis**:4.0.10、6.2.5、7.0.9、7.2.4、7.4.6、8.2.2 - **Zookeeper**:3.4.10、3.4.12、3.4.13、3.5.9、3.6.3、3.7.0、3.7.1、3.8.0、3.8.1、3.9.2 - **Sentinel**:1.8.8 - **GitLab** diff --git a/redis/7.4.6/Dockerfile b/redis/7.4.6/Dockerfile new file mode 100644 index 0000000..2a1364f --- /dev/null +++ b/redis/7.4.6/Dockerfile @@ -0,0 +1,40 @@ +# 构建阶段 +FROM alpine:3.18 +MAINTAINER Yang +ENV REDIS_VERSION=7.4.6 + +RUN apk add --no-cache \ + wget \ + gcc \ + make \ + musl-dev \ + zlib-dev \ + openssl-dev \ + linux-headers + +RUN cd / && wget http://download.redis.io/releases/redis-$REDIS_VERSION.tar.gz \ + && tar -zxvf redis-$REDIS_VERSION.tar.gz \ + && rm -rf redis-$REDIS_VERSION.tar.gz \ + && cd /redis-$REDIS_VERSION \ + && make MALLOC=libc \ + && make install \ + && cp /redis-$REDIS_VERSION/redis.conf /usr/local/bin/ \ + && cd / + +COPY start.sh /start.sh + +RUN apk add --no-cache libgcc tzdata + +RUN mkdir /redis /redis/conf /redis/logs /redis/data + +RUN chmod +x /start.sh + +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +RUN sed -i 's/logfile ""/logfile "\/redis\/logs\/redis.log"/' /usr/local/bin/redis.conf && \ + sed -i 's/bind 127.0.0.1/#bind 127.0.0.1/' /usr/local/bin/redis.conf && \ + sed -i 's/dir .\//dir \/redis\/data\//' /usr/local/bin/redis.conf + +EXPOSE 6379 16379 + +ENTRYPOINT ["/start.sh"] diff --git a/redis/7.4.6/start.sh b/redis/7.4.6/start.sh new file mode 100644 index 0000000..c97cc2a --- /dev/null +++ b/redis/7.4.6/start.sh @@ -0,0 +1,8 @@ +#!/bin/sh +if [ ! -e /redis/conf/redis.conf ]; then + cp /usr/local/bin/redis.conf /redis/conf + if [ -n "$PASSWORD" ]; then + echo "requirepass $PASSWORD" >> /redis/conf/redis.conf + fi +fi +redis-server /redis/conf/redis.conf diff --git a/redis/8.2.2/Dockerfile b/redis/8.2.2/Dockerfile new file mode 100644 index 0000000..9f63c90 --- /dev/null +++ b/redis/8.2.2/Dockerfile @@ -0,0 +1,43 @@ +# 构建阶段 +FROM alpine:3.18 +MAINTAINER Yang +ENV REDIS_VERSION=8.2.2 + +RUN apk add --no-cache \ + build-base \ + linux-headers \ + tcl \ + wget \ + gcc \ + make \ + musl-dev \ + zlib-dev \ + openssl-dev \ + linux-headers + +RUN cd / && wget http://download.redis.io/releases/redis-$REDIS_VERSION.tar.gz \ + && tar -zxvf redis-$REDIS_VERSION.tar.gz \ + && rm -rf redis-$REDIS_VERSION.tar.gz \ + && cd /redis-$REDIS_VERSION \ + +RUN make MALLOC=libc && make install + +RUN cp /redis-$REDIS_VERSION/redis.conf /usr/local/bin/ && cd / + +COPY start.sh /start.sh + +RUN apk add --no-cache libgcc tzdata + +RUN mkdir /redis /redis/conf /redis/logs /redis/data + +RUN chmod +x /start.sh + +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +RUN sed -i 's/logfile ""/logfile "\/redis\/logs\/redis.log"/' /usr/local/bin/redis.conf && \ + sed -i 's/bind 127.0.0.1/#bind 127.0.0.1/' /usr/local/bin/redis.conf && \ + sed -i 's/dir .\//dir \/redis\/data\//' /usr/local/bin/redis.conf + +EXPOSE 6379 16379 + +ENTRYPOINT ["/start.sh"] diff --git a/redis/8.2.2/start.sh b/redis/8.2.2/start.sh new file mode 100644 index 0000000..c97cc2a --- /dev/null +++ b/redis/8.2.2/start.sh @@ -0,0 +1,8 @@ +#!/bin/sh +if [ ! -e /redis/conf/redis.conf ]; then + cp /usr/local/bin/redis.conf /redis/conf + if [ -n "$PASSWORD" ]; then + echo "requirepass $PASSWORD" >> /redis/conf/redis.conf + fi +fi +redis-server /redis/conf/redis.conf diff --git a/redis/README.md b/redis/README.md index b67d7a2..e874e15 100644 --- a/redis/README.md +++ b/redis/README.md @@ -4,13 +4,13 @@ 镜像构建源码请[参考](http://git.yangyufans.com/pub/docker/tree/master/redis) ```bash -docker build -t ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10 . +docker build -t ccr.ccs.tencentyun.com/yy-dk/redis:8.2.2 . ``` ## 从远程仓库下拉 ```bash -docker pull ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10 +docker pull ccr.ccs.tencentyun.com/yy-dk/redis:8.2.2 ``` ## 创建容器 @@ -24,6 +24,6 @@ docker run -d \ -v /data/redis/logs:/redis/logs \ -v /data/redis/data:/redis/data \ -e PASSWORD=123456 \ - --name redis-4.0.10 \ - ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10 + --name redis-8.2.2 \ + ccr.ccs.tencentyun.com/yy-dk/redis:8.2.2 ``` \ No newline at end of file