Preparing to use Docker and Docker Compose from Windows 10 WSL
Now that I’m trying to experiencing with Microservices, I wanted to use my Windows 10 Surface Pro laptop, and see whether it’s possible to play with using WSL or not, just to create my lab environment
Installing WSL
WSL (Windows Subsystem for Linux), is the easy way of having linux on top of my Windows 10, so it’s perfect to use linux only related stuff.
As I’ve got one of the latest versions of Windows 10 (1809), I was able to install WSL the easy way:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Then, I installed latest Linux Ubuntu version from Microsoft Store
Afterward, setting up my new Linux user out of the box
Install Docker and Docker-Compose
As I had a Docker for Windows installation already configured, I only had to tweak it a bit and get it ready to use from WSL:
Going to WSL to install Docker
wget -qO- https://get.docker.com/ | sh
Also, Docker Compose, including all requirements
sudo apt-get update
sudo apt-get -y install python-pip
sudo pip install docker-compose
And after that, liked to verifying that Docker and Docker-Compose were correctly installed
docker info
docker-compose --version
Interconnect Docker for Windows and WSL
One liner, available everytime WSL start
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
Et voilà! easy peasy! See available Docker from WSL!