The Adventure Continues — Some Very Surface-Level Information About Docker

Or “Trying To Run Docker On Windows”

Evan SooHoo
4 min readMay 2, 2023

The setup of our project remains the same: Smack spun up a Linux development environment on AWS, and is now using a roughly 70-line Python script to stream audio from an RTL-SDR. He added Docker, and this blog post will be me trying to run the container on Windows via a basic “docker run” command. I was unsuccessful, but I did learn a few things about running Docker on Windows:

After that, I was still unsuccessful because I think I am messing up the EOL conversion. I tried the fix in the link attached, but it still gave me the same error.

I applaud you digging into this s***, but probably time to fire up a VM.
— Smack

If it’s not obvious, Smack wrote this program with Linux in mind.

Motivation

To write that Linux is better than Windows for development would be overly general, and out there somewhere is someone who got Docker working just fine. I could at least find this Reddit thread full of people who found it easier to just do development in Linux, but it would certainly be nice if I could get this to all work in Windows.

In fact, I have found more optimistic people right here:

https://www.reddit.com/r/docker/comments/n2higw/wsl2_and_docker_does_not_work_together/

So, two questions I never really asked before:

  • What exactly is Git Bash For Windows? I never questioned it
  • What exactly is WSL2?

If you Google “Git Bash For Windows,” it calls itself Bash emulation. This is nice for people who like to develop in Linux. Someone asked on SuperUser what “Git Bash For Windows” actually is. It seems that it is something that contains the familiar bash executables, like ssh, but that’s a simplification.

You are correct, Git Bash for Windows is not just bash compiled for Windows. It's package that contains bash (which is a command-line shell) and a collection of other, separate *nix utilities like ssh, scp, cat, find and others (which you run using the shell), compiled for Windows, and a new command-line interface terminal window called mintty.
https://superuser.com/questions/1053633/what-is-git-bash-for-windows-anyway

That explains SOME of the magic in the StackOverflow post. It lists this as a temporary solution to Python mysteriously hanging forever:

alias python='winpty python.exe'

Winpty is a Windows application that provides the Unix-like environment. That temporary solution is resolved with this, saving the alias line into .bashrc and loading up every time from that point on:

echo "alias python='winpty python.exe'" >> ~/.bashrc

WSL2 is sometimes considered the basic equivalent of virtualized Linux, but it’s apparently different in a few respects. Because of this, Smack’s idea to next try Virtualizing Linux may be worthwhile…but it also may be worthwhile to stay on this path.

Smack dual-boots.

I have a dedicated Ubuntu machine, but somehow it’s pulling a miraculous 1Mbps while this Windows-only laptop pulls 110 times that from the same connection. There are many reasons this may be happening, including but not limited to the recent update I made, to problems with its underlying hardware.

On Linux, this “docker run” command would have just worked*…with a massive asterisk. It would have just worked, provided it was a computer or virtual machine running a compatible Linux distribution at a decent speed.

Closing Thoughts

The way I see it, it’s kind of like I’m trying to play Halo 3. Every time I encounter The Flood, instead of looking for an alternative I just throw my computer against the wall. Developers have taken time to ensure the system works in a number of different environments, so it could still be worth pursuing. You don’t get good at a game by just blindly attempting the same brute-force strategy over and over again.

It makes me wonder what most people do in the real world. How many people use Docker on Windows, and how many people ditched the environment entirely to just use a dedicated Linux environment? How about hybrids? How many people use Windows for most of their development, then build the actual Docker containers on Linux?

I could just do the actual building on Smack’s AWS environment, but that would be cheating.

--

--

Evan SooHoo
Evan SooHoo

Written by Evan SooHoo

I never use paywalls (anymore) because I would get stuck behind them.

Responses (1)