@meyay
Well now, THAT sure was a trip 'round Robin Hood’s barn!
At first I was quite intrigued by your suggestion to look into Docker’s context
feature, especially after @rimelek helped me understand exactly what it was you were getting at.
So I dove into the docs and set out to learn what I needed to in order to set everything up (list, switch, remove, etc.). My command line tests revealed a configuration success, as I was able to issue docker info
at my Windows Server console and receive Linux output.
And for a fleeting moment I thought I had the answer to my dilemma. I thought that’s what I was looking for.
Not so fast. After running my pipeline again, getting yet another failure, and following the bread crumbs of the source code from the NuGet package I’m using (Testcontainers), I found that they’re using the Docker API, which, as it turns out, doesn’t respect the context
.
With that, then, I figured I’d just point my Testcontainers host (that’s a feature they provide) to the SSH endpoint that I use when connecting to WSL2. But before I could automate that from a pipeline I had to study up on how to enable password-free authentication in SSH (i.e. key pair). OK, now… got that set up? Yep. Check. Let’s go.
Uh-oh… Docker doesn’t know what an SSH endpoint is.
So then I had to (learn how to) enable a TCP endpoint instead. And that was a certifiable pain-in-the-foot, because it turned out that my Docker installation somehow had been done with snap
instead of systemd
, and all the advice I was finding was for systemd
. So I never did get it listening under snap
. After much futzing and failing, I uninstalled and reinstalled under systemd
, reconfigured using these simple steps, and then restarted the service. Finally I had a listener.
I reran my pipeline, this time pointing to the TCP endpoint instead (actually, I ended up setting the DOCKER_HOST
environment variable for ease of use), and voila! Success! Houston, we are a go.
Through all this I’ve been able to determine that I don’t need to use WSL2 at all—in fact that just complicates matters, since it’s not reachable from other machines on the network. My working setup ended up being a plain-vanilla Ubuntu Server instance, running in its own VM.
Is it all worth three full days of head-pounding trial and error? (Which, by the way, included a trip down the rabbit trail of switching to Windows containers on my dev box and learning how to build my own MS SQL Server image/container, only to discover that Testcontainers doesn’t support SQL Server in a Windows container.)
I’ll go out on a limb here and convince myself that yes, it is worth it, because the ability to run my tests in containers is invaluable to me. I’ve wanted to do this for quite some time, and I hesitated because I knew it was going to be a baptism by fire. I was right, but now it’s over with. I’ve got a handle on this.
Thanks for your help, both of you. I appreciate it.