This is an PoC about building a distroless Redis Docker image.
How to build the image
docker build -t redis:distroless --build-arg REDIS_VERSION=5.0.9 --build-arg GCC_VERSION=9 .
Notes about compilers As fas as today, July 25th 2021
- Use gcc:9 to compile Redis 5.X
- Use gcc:10 or higher to compile Redis 6.X
Image contents If you dive the image. These are the only contents
├── bin │ └── redis-server └── etc └── redis └── redis.conf
Image size
docker image ls | grep -i redis
redis distroless f2df04acb352 14 minutes ago 13.5MB
redis alpine eb705d309426 47 hours ago 32.3MB
Run the image
docker run redis:distroless
1:C 25 Jul 2021 11:17:56.935 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 25 Jul 2021 11:17:56.935 # Redis version=5.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 25 Jul 2021 11:17:56.935 # Configuration loaded
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.9 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 1
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
1:M 25 Jul 2021 11:17:56.936 # 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 25 Jul 2021 11:17:56.936 # Server initialized
1:M 25 Jul 2021 11:17:56.936 # 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 25 Jul 2021 11:17:56.937 * Ready to accept connections