Dockeredis container failed to load configuration file

  docker, question
  • Development environment: macbookpro 10.11.4, docker for mac 1.12.3,redis 3.2.6, mirror source DAOCLOUD

  • I plan to set up a redis master-slave service and set up redis.conf myself, but the running Redis-Server/USR/Local/Bin/Redis. Conf in the container cannot take effect. It has been verified by redis-cli info, and the container cannot be started if the configuration file is specified by adding the -d option to set the startup parameter at startup.

  • The following is containerlog.

    1:C 17 Dec 14:34:47.683 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf

    _._
     _.-``__ ''-._
     _.-``    `.  `_.  ''-._           Redis 3.2.6 (00000000/0) 64 bit
     .-`` .-```.  ```\/    _.,_ ''-._
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 1
     `-._    `-._  `-./  _.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |           http://redis.io
     `-._    `-._`-.__.-'_.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |
     `-._    `-._`-.__.-'_.-'    _.-'
     `-._    `-.__.-'    _.-'
     `-._        _.-'
     `-.__.-'

    2016-12-17T14:34:47.685186833Z
    1:M 17 Dec 14:34:47.685 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
    1:M 17 Dec 14:34:47.685 # Server started, Redis version 3.2.6
    1:M 17 Dec 14:34:47.685 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/ kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
    1:M 17 Dec 14:34:47.689 * DB loaded from disk: 0.004 seconds
    1:M 17 Dec 14:34:47.689 * The server is now ready to accept connections on port 6379

  • redis.conf

protected-mode no
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile “”
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
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
appendonly no
appendfilename “appendonly.aof”
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
aof-load-truncated yes
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

docker run -v /myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf --name myredis redis redis-server /usr/local/etc/redis/redis.conf