Redis & Docker: A Hands On

Article Series

Route 1: Install Redis on Linux

wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz        // Unzips Redis
cd redis-stable // Moving into the directory
make // Compiling the Redis source
sudo cp src/redis-server /usr/local/bin/       // Copy redis-server
sudo cp src/redis-cli /usr/local/bin/ // Copy redis-cli
sudo make install                    // Takes care of bunch of stuff 
// to make Redis accessible.
redis-server
redis-cli
PING & PONG

Route 2: Install Redis via Docker

Part 1: Installing Docker Desktop (supports only Windows 10)

Docker Desktop From Start
Docker from Hidden Icons in Taskbar

Part 2: Installing and Setting Up Redis on Docker

Open Command Prompt from Run
docker pull redis                      // Installs Redis on Docker
After Install Screen Capture
docker run --name <container-name> -p <port>:<port> -d redis// Example: Setting name as harsh-redis and using the default Redis port
docker run --name harsh-redis -p 6379:6379 -d redis
Redis Docker Instance Created. Redis is Up and Running.
docker ps -a
docker exec -it <container name> redis-cli// Example: Container Name - harsh-redis
docker exec -it harsh-redis redis-cli
Hooray!!! Redis on Docker Works!!!

Gotchas

docker ps -a
Oh Oh! The Redis container is down. Call the Shaman!
docker start -a <container name>
// For the above example, it would be
docker start -a harsh-redis
Redis is Up. Praise the Sun!

Developer. Designer. Blogger.

Developer. Designer. Blogger.