docker 启动redis容器

dockerfile

FROM registry.cn-hangzhou.aliyuncs.com/xxxholic/redis
COPY redis.conf
EXPOSE

redis.conf

protected-mode yes
port
tcp-backlog
timeout
tcp-keepalive
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases
always-show-logo yes
save
save
save
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./ #rdb和aof存放文件的目录
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay
repl-disable-tcp-nodelay no
slave-priority
requirepass hzjrypt
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
latency-monitor-threshold
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-size -
list-compress-depth
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
hll-sparse-max-bytes
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
aof-rewrite-incremental-fsync yes

build

docker build -t redis . 

//push到私有仓库
docker tag hzjry-redis 10.10.10.12/hztest/hzjry-redis
docker push 10.10.10.12/hztest/hzjry-redis

启动与测试

 //启动redis容器,持久化文件默认存在了data目录(dir ./,可自定义到别的目录)
docker run -itd --name hzjry_redis -p : -v /data/admin-web/redis:/data hzjry-redis --appendonly yes #appendonly yes为启用持久化,默认配置文件赔了可不加此参数 //tomcat启动时连接redis
docker run -itd --link hzjry_redis:redis tomcat
上一篇:docker启动、关闭、重启命令


下一篇:IIS发布网站,浏览网站时候,出现 试图加载格式不正确的程序。