Redis on Docker on Windows, Oh My!

  • October 24, 2017

    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.

    Step-by-Step:

    1. First download and install docker for Windows from the stable channel.
    2. Restart your computer.
    3. After your computer restarts you may or may not be presented with a pop up from Docker asking to enable Hyper-V:
    4. Click Ok and restart your computer. It may restart more than once while it’s enabling Hyper-V
    5. Open Power Shell and run command: docker run -d -p 6379:6379 redis
    6. An easy way to inspect your Redis instances it to use Redis Desktop Manager
    7. Once the Redis Desktop Manager is installed click the Connect to Redis Server Button.
    8. 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
    9. Now you will see the name of your connection. This is showing you are not connected.
    10. 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

     

    Comments(0)

    Leave a comment

    Required fields are marked *