I Did It!
I’ve recently made the full switch to Windows 10 as my primary linux development environment. This is a neat little post about the pros and cons, how I have it set up, and the things I’ve learned.
What a normal day is like
My day starts by usually with some vague order of the following:
- Start up Slack
- Start up PuTTY to login to work
- Start up terminator for working in Bash for Windows
- Start up IntelliJ
- Start up Chrome
The services I run:
- Docker for Windows
- VcXsrv (for displaying xwindows programs like terminator, firefox, etc)
- Service Fabric Cluster
- HyperV (with a couple vm’s for testing things)
Once I’m up and running, I start coding. I have a few tyche processes that manage my development workflow.
Using Docker in Bash for Windows
If you’ve had the luxury of using Bash for Windows, you’ll quickly realize that Docker in Bash doesn’t exactly work out of the box. Getting it to work is as simple as downloading the binary somewhere in your path and adding export DOCKER_HOST=tcp://0.0.0.0:2375
to your .profile
.
If you need to use Docker Compose, it’s a little more elaborate. This is the wrapper I have in my path:
#!/bin/bash
convertC() {
echo ${1#"/mnt"}
}
convertWin() {
declare start=${1#"/"}
start=${start:0:1}:${start:1}
echo $start | sed 's#/#\\#g'
}
target=$(convertC $(pwd -P))
source=$(convertWin $(convertC $(pwd -P)))
docker run \
-it \
--rm \
-v "$source:$target" \
-w $target \
-v /var/run/docker.sock:/var/run/docker.sock \
docker/compose:1.9.0 \
$@
It requires being run from the /mnt/c/ tree, since the things inside the usual subdirectories are invisible to Windows and Docker is actually in Windows, not linux. What this wrapper does, is take the current path and mount it in the docker/compose container and run docker-compose
from inside the container.
So, basically, if you run this from /mnt/c/Users/withi/code/wp-calypso
it will turn out like docker run -it --rm -v "c:/Users/withi/code/wp-calypso:/c/Users/withi/code/wp-calypso" -w /c/Users/withi/code/wp-calypso -v /var/run/docker.sock:/var/run/docker.sock docker/compose:1.9.0 $@
This makes docker-compose
feel 100% native to Linux on Windows. I’ve thought about making a similar wrapper for docker
as well. It’s just too easy to convert the paths after awhile.
So how about XWindows
Getting X running was probably one of the more easier things. I just downloaded VcXsrv and installed it, then sudo apt install terminator
and created a shortcut to run it. It’s literally as easy as installing zsh …
I made this all easy for you
I started this repo, based on the legendary dotfiles … check it out. It’s nothing fancy, but it’s a start. I’ll probably convert it to the actual dotfiles at some point… When I have a few days to start all over.
Cons
- Blue Screen of Death(!)
- Basically required to be on the insider fast ring (as of right now — for file watching).
- Unix and Linux aren’t exactly the same thing…
- Constant battle for RAM (on an i5, Surface Pro 3 with 8GB of RAM)
- Constant need for wrappers around certain docker tools
- No homebrew 🙁
Pros
- You’re running native Ubuntu linux (for all intents and purposes)
- Ability to (almost) run Docker like it should be run
- A faster filesystem
- Regular linux software (apt for the win!)
- Windows! (I’m referring to the familiarity — we all grew up on this OS, right?)
- Quick and easy Visual Studio, see next point.
- No vm’s required (except for the Docker one, and that may not be for long), in OSX, I needed a Windows VM, Docker VM, Linux VM for testing, vagrant, etc
- Full integration via Cortana to my Android phone