Running with Docker
The official redis image from Docker Hub is the simplest and most reproducible way to run Redis, including on macOS and Windows. The command publishes port 6379 on the host and mounts a named volume redisdata on /data, the directory where Redis writes its persistence files. Pin a version (redis:7) rather than latest for deterministic deployments.
Persistence and configuration
By default, the image writes an RDB snapshot to /data. To enable the append-only log (more durable), add the option at the end: docker run -d --name redis -p 6379:6379 -v redisdata:/data redis:7 redis-server --appendonly yes. For a full configuration, mount your own redis.conf (-v ./redis.conf:/usr/local/etc/redis/redis.conf) and run redis-server /usr/local/etc/redis/redis.conf.
Interaction and security
Connect to the server with docker exec -it redis redis-cli. To add a password without a configuration file, pass --requirepass <password> after the image name. Only publish port 6379 on 0.0.0.0 if access is protected (password + firewall); in development, prefer binding the port to the loopback, for example -p 127.0.0.1:6379:6379.