Steps to build specific version Redis server [Docker Edition]

Tadashi Shigeoka ·  Sat, February 9, 2019

I’ll introduce the steps to build a specific version Redis server with Docker.

Prerequisites

  • Redis: want to use version 2.8
  • OS: macOS Mojave
  • redis-cli already installed with brew install redis

Start specific version redis server with docker

Get docker image & initial startup

docker run --name redis2.8 -p 6379:6379 -d redis:2.8

Check redis startup with docker logs

docker logs redis2.8 -f                                                        
[1] 13 Feb 06:04:15.743 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 2.8.23 (00000000/0) 64 bit
  .-`` .-```.  ```\\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

[1] 13 Feb 06:04:15.744 # Server started, Redis version 2.8.23
[1] 13 Feb 06:04:15.744 # 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] 13 Feb 06:04:15.744 # 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] 13 Feb 06:04:15.744 * The server is now ready to accept connections on port 6379

Check connection to redis-server with redis-cli

Finally, check connection to the redis-server built on docker via redis-cli command and verify the version. I’ll use the redis-cli command installed on macOS with brew install redis.

$ redis-cli
127.0.0.1:6379> INFO Server
# Server
redis_version:2.8.23
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:f02b64ca84a0dc52
redis_mode:standalone
os:Linux 4.9.125-linuxkit x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.9.2
process_id:1
run_id:b3a1f6c434378b687d2787247b00788853b647cc
tcp_port:6379
uptime_in_seconds:1153
uptime_in_days:0
hz:10
lru_clock:6535136
config_file:

Redis start/stop commands

Stop redis

docker stop redis2.8

Start redis

docker start redis2.8

That’s all from the Gemba where I occasionally want to use older versions of redis.

Reference Information