Running Redis in Docker

These are the quick notes.

Note

Redis uses port 6379 as the default, which is where those ports in the command come from.

Install

docker pull redis
docker run -d -p 6379:6379 --name redis redis

Use it with python-redis

import redis
client = redis.Redis("localhost", 6379)
client.keys()

The client.keys() is a double-check. The client object won't actually try to connect to the server until you call it.