October 24, 2017
Redis on Docker on Windows, Oh My!
By Andrew Cook
Andrew Cook is a Software Development Consultant specializing in helping organizations migrate and develop applications that leverage the power of Microsoft Azure.
Why Redis on Docker?
When developing an application with a Redis cache layer there are times during the development process where cached data can become stale. By using Redis on Docker a developer can have a local Redis cache that is easy to create and destroy ensuring that no old data persists. I have used this several times when my data schema is changing as well as most commonly to ensure that I’m not using any stale data.
One of the reasons I use Redis on Docker is that I can stand up multiple Redis databases and create new ones quickly.
- First download and install docker for Windows from the stable channel.
- Restart your computer.
- After your computer restarts you may or may not be presented with a pop up from Docker asking to enable Hyper-V:
- Click Ok and restart your computer. It may restart more than once while it’s enabling Hyper-V
- Open Power Shell and run command: docker run -d -p 6379:6379 redis
- An easy way to inspect your Redis instances it to use Redis Desktop Manager
- Once the Redis Desktop Manager is installed click the Connect to Redis Server Button.
- Which will open the connections settings
- Specify a name (I used Redis on Docker)
- Enter localhost for the server
- Leave the port as 6379
- Click Ok
- Now you will see the name of your connection. This is showing you are not connected.
- Click on the name of your connection. Now it will list all the database in the selected Redis Server instance; by default it’s 16.
From there you should be set to utilize Redis on Docker!
To learn more about Andrew follow him on twitter @codingwcookie or browse his personal blog https://codingwithcookie.com