docker run --net=host -d redis6379
docker run -p 6379:6379 -d redis6379
About ip forwarding:
- "--net=host", this make the newly created container use host's ip and own exposed ports. This is the way currently to support redis cluster.
- "-v 6379:6379", works very similarly to the above way, except this will not work for redis-cluster. The explanation is at the bottom.
Docker image using supervisord to start COMMAND. Different from official one, which uses gosu and corresponding entrypoint.sh.
1) official ubuntu baseimage.(official redis docker uses alpine or debian)
2) supervisord, from here we can start multiple processes and control them easily.
Why I don't use official redis docker?
This is just because of the unstable cdn of Alpine apk index archives and gosu source files to download. Also I don't like gosu to start services under specific users.
Even though the docker image generated by this way is much smaller, ubuntu based image is still my favorite, on which most of my docker images are built.
Github repo for Docker files:
Here I put a lot of stuff here. Most of them works for cluster, but also includes :
- alpine_entrypoint: Alpine as base image + apk redis package + entrypoint.sh (no gosu)
- ubuntu_entrypoint: Ubuntu as base image + redis-3.0.7.tar.gz + entrypoint.sh (no gosu)
- archive: Some redis binary usage (no docker)
- Currently, redis cluster (by using redis-3.0.7), doesn't support port forwarding etc. This is stated on Antirez's github redis issues commnents: https://github.com/antirez/redis/issues/1703#issuecomment-165959140