日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Docker 制作镜像-redis

發布時間:2025/5/22 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Docker 制作镜像-redis 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1: 先創建dockerfile目錄
mkdir -pv /docker/redis

2: redis安裝腳本vim /docker/redis/install.sh
yum install -y net-tools gcc gcc-c++ make tar openssl openssl-devel cmake

cd /usr/local/src
wget 'http://download.redis.io/releases/redis-4.0.9.tar.gz'
tar -zxf redis-4.0.9.tar.gz
cd redis-4.0.9
make && make PREFIX=/usr/local/redis install

mkdir -pv /usr/local/redis/conf /usr/local/redis/bin
cp src/redis* /usr/local/redis/bin/

3: redis的配置文件vim /docker/redis/redis.conf
bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile "/tmp/redis.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /tmp/
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

4: 前臺啟動redis
/usr/local/redis/bin/redis-server /docker/redis/redis.conf

5: Dockerfile編寫
FROM centos7
MAINTAINER liming liming_01@163.com
COPY install.sh /tmp/install.sh
COPY CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo
RUN sh /tmp/install.sh; \rm -rf /usr/local/src/*
COPY redis.conf /usr/local/redis/conf/redis.conf

6: 構建鏡像
docker build -t my_redis .

7: 測試能否正常啟動redis server
docker run -d my_redis /bin/bash -c '/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf'

轉載于:https://www.cnblogs.com/mountain2011/p/11306126.html

總結

以上是生活随笔為你收集整理的Docker 制作镜像-redis的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。