# Create a network for a Redis
docker network create redisnet
# Run a single instance that is automatically removed after being killed
docker run --rm --net redisnet --name redis -d redis
# Now you should see Redis container running
docker ps
# Launch redis-cli that is automatically removed after exit
docker run --rm --net redisnet --name redis-cli -it goodsmileduck/redis-cli redis-cli -h redis.redisnet
# After you are done with experimenting, kill Redis container
docker kill redisNOTE: You can add
-p 127.0.0.1:6379:6379to your redis container to access port locally and not only through redis-cli in the docker container.
docker-compose updocker exec -it redis-1 redis-cli -p 7000 --cluster create \
192.168.0.2:7000 \
192.168.0.3:7001 \
192.168.0.4:7002 \
192.168.0.5:7003 \
192.168.0.6:7004 \
192.168.0.7:7005 \
--cluster-replicas 1Then type yes and you are ready to go.
NOTE: use
-cto enable cluster mode
docker exec -it redis-1 redis-cli -c -p 7000docker-compose down| David Procházka | Josef Podaný | Matěj Tužil |
|---|---|---|
github.com/ProchazkaDavid |
github.com/josefpodany |
github.com/xtuzil |