Install, Run and Interact with Redis under docker on Windows 10
Run the docker command below to download redis and add it to your local docker containers
docker pull redis
Next start above redis instance using below command
docker run — name redis -d redis
You may now see the redis container running using below command
docker ps -l
If you wish to start instead with persistent storage then run below command
docker run — name redis -d redis redis-server — appendonly yes
Note: Only one out of above two run commands will be applicable one time.
Use below command to see the redis logs
docker logs redis
Starting an interactive session with above running redis container
docker exec -it redis sh
you get the # prompt and now run redis-cli at the prompt as below
#redis-cli
this hooks you to the default redis port 6379 on your localhost as below
127.0.0.1:6379>
Now you’re ready to run the redis commands on redis-cli.
Setting up Key-Value pairs with set command
For example
127.0.0.1:6379>set game Soccer
Retrieving saved values using Keys
For example
127.0.0.1:6379>get game
Other redis-cli commands
#clear
#exit
Complete redis-cli command reference is available here and here.