Running Redis on Docker on Windows

When it comes down to OS’es, I’m not the monogamous kind of guy. I like things that work on Windows, Linux, and Mac, preferably without a lot of troubles (actually, preferably without any troubles, but, I’m a realistic type of guy as well). As such, I was interested to see the power of Redis, but dissapointed it doesn’t really run “out of the box” on Windows. Ok, there is a port avialable, but that’s not always the real thing. So I decided to kill two birds with one stone, and bring in another technology that is still on my bucket list: Docker.

Docker is a software container technology and has some nice advantages for both developers and IT admins, and after 15 minutes it turns out to run real smooth on my Windows machine as well. More information can be found on the Docker site installation documentation. Another nice and very to the point intro can be found here. Note that running Docker on Windows really involves quite some technology, but the installer really hides that nicely. Once docker is running, make sure you know the IP address of the VM host it is running on so you can connect later. It is logged in the console, but will not be visible anymore after running the redis command.

Phase 1 completed, and for those who like open source technology combined with really fast, no nonsense installation and the usual struggles, I really advise Docker and their public repositories. Installing Redis on Docker is a single line command:

docker run -p 6379:6379 redis

If all goes as planned, after the download, your Docker window should look like the below image.

Truth to be told, I did have some issues during installation, where it had an unexpected EOF and the untar command failed. This seem to be common and according to different sources is caused by the “network” and more specifically the “Wifi”. I don’t know the details, but disabling Wifi and continue on the wire solved the issue.


And that is actually all! Redis is running on your machine, ready to use, which means in my case to be used from within NodeJS. Tons of information are available on how to do this, so I will simply show my sample test code I quickly wrote in the Visual Studio Code editor, and this for four reasons:

  • I’m fond of the editor, which I expressed in my previous post
  • You can really easily debug your server side code
  • I really like intellisense that can be added via, it is available for most common node modules and thus also for redis package, and can be simply added by adding the references on top of the file
  • Be warned when connecting to the Redis server. First of all, because this is actually running in a VM with a virtual network on your machine, and thus you need to connect using an IP address as the default localhost will not work. Second, you will use hostname/IP address and port combination, and Redis client takes the port number first. It could be me, but in all languages where I connected to a server, host name is first and then port number comes second. Of course the documentation is correct, but it was that trivial for me that it took me a while to notice and I spend to much time wondering why I was always getting these connecting errors.


And here it is, a full functioning system with Redis running in Docker on Windows and connecting via NodeJS app written in VSCode.




Visual Studio Code for writing and debugging NodeJS applications

I’ve always been a fan of Visual Studio. I started using it when it was still version 6 (when my professional life started) and the only reasonable language was C++. Even though I worked on many different platforms in the meantime, none of the tools I encountered ever came close to Visual Studio. You can hate MS as much as you want (which I do not) but you have got to love their development environment.

Last couple of months I really got into the NodeJS world, which I think is a really great environment: you can develop on any platform, and it runs on all of the platforms, cloud or on premise, everybody supports it. You cannot get any “vendor lock-in”, which is great and you have all options open. You want to move to Azure? Fine, no problem. Amazon. Equally ok. Run locally on your Macbook. Done. An extra advantage is the simple type and run principle (which is a well known principle I just invented), which means there is no compilation or building required before running the application.

If you read this intro, you will understand that I was very pleased with the announcement of Visual Studio Code, which fits perfectly in my scheme of things. Of course there is Sublime which everybody is using for this kind of task (just as me), and truth to be told, some of the VSCode features are simply copies, but it works equally good for me, and has suprised me. Biggest reason why it pleases me: it’s simple. As powerfull as Sublime is, I only used 2% of it’s features for developing node applications, so it was too much. VSCode is simple, offering everything I needed, and even more, using the docs on I was able to create a “blanco nodejs template application” and configure debugging in under 5 minutes. Combine this with the great support for client side javascript debugging we have today in allmost all browsers, and you have full support for debugging on client and server!

vscode debugging


Another great feature is the support for type definitions in combination with the intellisense. All info is in the docs, just mentioning it here because it actually really works, even tough I’m not the biggest fan of Typescript (I don’t like any “extra” steps for converting or compiling things… remember the type and run principle), I don’t even use it my apps. It just great to have intellisense support for the basics of a language.


Next job is to experiment with the task features VSCode offers, which also seems to solve some issues for me… but I need a little more time for that one.

Two remarks to close this article:

– It could well be that Sublime is equally capable of doing all of this, I don’t know. And that is exactly my point. In all the power of Sublime I couldn’t easily find these things, while with VSCode I got things running in no time with a very to the point document

– There are still some improvements to be done on VSCode, especially the part on HTML tags feels sometimes wrong. For example, in any modern HTML editor typing <br> will convert your tag to <br />, while VSCode will just complete the tag, so you end up with <br></br> which of course nobody wants. Same goes for a lot of other tags. Also starting a closing tag does not automatically bring up intellisense to suggest the rest of the tag. These features are available in Visual Studio 201x, so they know how to do it…