From 80207e6d4a796695c61e0e16f3e56c2fde3b545e Mon Sep 17 00:00:00 2001 From: yangyu Date: Fri, 13 Jul 2018 20:33:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0redis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- redis/{ => cluster}/4.0.10/Dockerfile | 0 redis/{ => cluster}/4.0.10/start.sh | 0 redis/cluster/README.md | 16 +++++++++++++ redis/standalone/4.0.10/Dockerfile | 34 +++++++++++++++++++++++++++ redis/standalone/4.0.10/start.sh | 11 +++++++++ redis/{ => standalone}/README.md | 0 sshd/centos/7.0/Dockerfile | 0 7 files changed, 61 insertions(+) rename redis/{ => cluster}/4.0.10/Dockerfile (100%) rename redis/{ => cluster}/4.0.10/start.sh (100%) create mode 100644 redis/cluster/README.md create mode 100644 redis/standalone/4.0.10/Dockerfile create mode 100644 redis/standalone/4.0.10/start.sh rename redis/{ => standalone}/README.md (100%) create mode 100644 sshd/centos/7.0/Dockerfile diff --git a/redis/4.0.10/Dockerfile b/redis/cluster/4.0.10/Dockerfile similarity index 100% rename from redis/4.0.10/Dockerfile rename to redis/cluster/4.0.10/Dockerfile diff --git a/redis/4.0.10/start.sh b/redis/cluster/4.0.10/start.sh similarity index 100% rename from redis/4.0.10/start.sh rename to redis/cluster/4.0.10/start.sh diff --git a/redis/cluster/README.md b/redis/cluster/README.md new file mode 100644 index 0000000..0282423 --- /dev/null +++ b/redis/cluster/README.md @@ -0,0 +1,16 @@ +# redis 集群搭建 +## 创建镜像 +```bash +docker build -t redis:4.0.10 . +``` +## 创建容器 +```bash +docker run -d \ + --privileged=true \ + -p 6379:6379 \ + -v /data/redis/conf:/redis/conf \ + -v /data/redis/logs:/redis/logs \ + -e PASSWORD=123456 \ + --name redis-4.0.10 \ + redis:4.0.10 +``` \ No newline at end of file diff --git a/redis/standalone/4.0.10/Dockerfile b/redis/standalone/4.0.10/Dockerfile new file mode 100644 index 0000000..46da7f5 --- /dev/null +++ b/redis/standalone/4.0.10/Dockerfile @@ -0,0 +1,34 @@ +FROM centos:7 + +MAINTAINER Yang + +ENV REDIS_VERSION=4.0.10 + +RUN yum install -y wget gcc make + +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 / \ + && rm -rf redis-$REDIS_VERSION + +RUN mkdir /redis /redis/conf /redis/logs + +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 + +RUN echo "ZONE=Asia/Shanghai" > /etc/sysconfig/clock && \ + rm -rf /etc/localtime && \ + ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +COPY start.sh / + +RUN chmod 777 /start.sh + +EXPOSE 6379 + +ENTRYPOINT ["/start.sh"] diff --git a/redis/standalone/4.0.10/start.sh b/redis/standalone/4.0.10/start.sh new file mode 100644 index 0000000..61150cd --- /dev/null +++ b/redis/standalone/4.0.10/start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ ! -e /redis/conf/redis.conf ]; then + cp /usr/local/bin/redis.conf /redis/conf +fi + +if [ -n "$PASSWORD" ]; then + echo "requirepass $PASSWORD" >> /redis/conf/redis.conf +fi + +redis-server /redis/conf/redis.conf diff --git a/redis/README.md b/redis/standalone/README.md similarity index 100% rename from redis/README.md rename to redis/standalone/README.md diff --git a/sshd/centos/7.0/Dockerfile b/sshd/centos/7.0/Dockerfile new file mode 100644 index 0000000..e69de29