I’ve previously blogged about running a Docker Linux container on Windows to run VS Code on Linux and at the time I was really just doing it because I wanted to work out if it was actually possible, which it was! But in reality it was really a solution just looking for a problem.
Well, good news, I have found the problem that this is a valid solution for! Well, as valid a solution as I can come up with at least.
One of my pet projects is a PowerShell module for managing different Node.js versions, called nvm. This little module has been floating around for a few years now, I add things to it whenever I find a problem, or someone reports one.
The other month someone raised an issue, the module didn’t work on OSX. Well I wasn’t surprised, I’d never tried it on OSX but Felix was willing to give it a go. After a bit of back and forth it was all up and running. We then worked on a few other steps that saw automated tests written and CI setup on AppVeyor and Travis-CI.
And then what’s next, well adding Linux support of course! It’s being tracked here. There was a problem though, an error is reported when running the tests, an odd error about version numbers. I figured that the error was coming something in the test framework but I don’t know where so I needed to do some investigation.
But how do you do that when a) PowerShell is running on Linux and b) I don’t run Linux?
So I know you can run PowerShell in a Linux container and I previously proved I could run VS Code on a Linux container with X11 forwarding to Windows, so why don’t we combine them, install the PowerShell VS Code extension and debug the tests! It beats trying to work out how to setup remote debugging.
It was just a matter of taking Jessie’s VS Code Dockerfile, changing the
FROM to be
from microsoft/powershell and then you’re good to go!
Aww yeah! 😀