Guide to get a development environment on Windows 10
While giving the opportunity to work remotely for a client, I was left with a computer working with... Windows 10. Yeay... Ubuntu, I miss you. 😭
Here comes the story of a little human developer, trying to leverage Docker on Windows and Azure ActiveDirectory as an account manager.
The goal of this post is to create an environment as close as possible to what we are used to on Linux distro.
Learn to Windows to "understand" Unix commands
First, we need to have a safe and warm CLI environment to work with.
How do you create directories without
mkdir, add aliases as
ls -lah, symbolic links or to install softwares...
I can recommend you to head to Chocolatey. It is a package manager for Windows.
You can find all packages available through the CLI command
choco search a-package-name or thanks to their website.
Yes, first step accomplish! No more install from fancy, non working UI. And yes, you can do things like
choco install nodejs. Or even...
Wait for it...
Install Docker on Windows
Thanks to the previous step, you can install one of the precious tools that can saves you from installing NodeJS, PHP or anything on your host. As before, use your CLI tool, to write:
choco install docker-desktop docker -v docker-compose -v docker run hello-world
✅ Thanks to those commands, you might have a working Docker setup. You might use it to test PHP or NodeJS projects. I often simply use the following command when I have to preview locally my blog posts.
docker run --rm -it -p 8000:8000 --workdir /data -v path-to-my-project:/data node:10 yarn develop --host=0.0.0.0
Get a fancy Console Emulator
My go-to terminal for Windows is called Cmder. It comes with a set of Unix commands and Git-for-Windows integrated.
That's because it's a package containing Clink and ConEmu which could use Cygwin (to get
that Linux feeling - on Windows).
Or, since June 2019 you can find a newer terminal for Windows with Cygwin.
Heads to an already available console/terminal and type:
choco install microsoft-windows-terminal or
choco install Cmder depending on the one you chose.
How to share your C drive on Windows for Azure AD users
First, try to follow this article. If it doesn't work, in File explorer go to the folder you'd like to map as a volume, and add the user and give them full control. With this configuration, I was able to get access to files in docker containers.
One more thing to consider is an update to WSL2 with the newest Preview of Docker for Windows. I didn't try it yet but I have bad performances for Docker compared to my Ubuntu or MacOS. But that was expected... 🤷♂️
Talking about Windows Sub-system for Linux (WSL)
[2020/06/06 Update] You might find everything you need to start with WSL 1 or 2 from this article on "Setting Up Docker for Windows and WSL to Work Flawlessly"
I tried to work with it but it doesn't feel right. It feels even slower than using Docker directly with CMD or Powershell. I'm looking forward for WSL 2 in early 2020. Hope this will help all of use, forced/enjoying to work with Windows professionally.
Today, if you need to install Debian or Ubuntu under WSL, follow this great guide from Microsoft.
[Update from 02/20/2020 : I now use WSL with asdf-vm for dependencies to PHP or NodeJS. It's ok, smooth to switch between versions and using the Windows Terminal is better for it. I still use docker and docker-compose for tools like RabbitMQ or Redis.