dimanche 19 juin 2016

Docker CLI on WSL for Docker beta on Win10

Introduction

For this second post, I will continue the work of getting WSL to feel even more "home".
As stated before, I have "crazy" ideas and 2 of them are:
  1. Get a "Docker Ocean" where both MSWhales and NixWhales can swim freely ;) -> simply means that I could pull both kernels images and run them on Win10 (if possible), while choosing the Linux Docker CLI instead of Powershell. Yes, just because I can (and because that's this blog topic).
  2. I have the chance to have a Pluralsight account (thanks Boss) and I would like to edit files with the great VSCode, while running the backend services on WSL. My current test is Angular2 (but more to come eventually on a future blog post).

Goal of this blog post

Nothing fancy here, just want to show (if you don't know it by know) how easy it is to interact between WSL and the Win10 "hosting" it.
Also, I'm trying to put all the building blocks together in order to achieve my crazy idea 1.

Prerequisites

Based on the Goal described above, there's only 2 mandatory prerequisites and 1 optional:

Docker installation on WSL

Be ready as this one will be the most difficult task of this blog post:
 $ curl -sSL https://get.docker.com/ | sudo sh 

Ok, it will indeed "install" Docker, however the Daemon will fail to start:

Still, the Docker CLI is installed and working fine. And, as expected, only  $ docker version  is returning a result:

Just for a comparison, here is the result of  > docker version  from Powershell:

Make it work all together

Before you can finally start playing with Docker, there's one last important setting to configure in order to be able to communicate with the running Docker Beta daemon:
 $ export DOCKER_HOST=tcp://:2375 

And now you can choose either Powershell or "Bash on Ubuntu on Windows" (yes, doing it on purpose until a better name comes :) to manage Docker containers on Win10:

Final thoughts

The more I "play" with Win10 and WSL, the more it confirms my impression: Win10 is all about possibilities and choices.
The "how can I" replaced the "why can't I" ... 

Big props again to all the persons involved in or outside Microsoft.

Darth Nunix


dimanche 12 juin 2016

Ubuntu 16.04 on Ubuntu on Windows (WSL)

Disclaimer

First thing first, I'm a quite average technical person. I know a bit of everything without being specialized in anything.
This actually sometimes work in my favor, as I do not fear to test "crazy" things that are, normally, not meant to go together.

Prerequisites

Windows side

  1. Be part of Windows Insider (fast ring preferred)
  2. Have the latest Windows 10 Insider release installed
  3. Install Windows Subsystem for Linux (WSL) feature

Linux side

  1. Get the Repositories list for Ubuntu 16.04
  2. Make a backup of the current sources.list
     $ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 
    • For information, here is the default sources.list
  3. Update the Repositories list with the list for Ubuntu 16.04

Finally the upgrade

As for any upgrade, once everything has been prepared well, the upgrade itself will (normally) only be a question of install wait.
I will, on purpose, be verbose with the commands, and if you know a bit of Linux commands, I'm sure you can do it in one line.
NOTE: as I'm posting this blog after I've done the upgrade, I have unfortunatly no printscreens to share of the upgrade itself.
  1. Update the list of packages available after the "sources.list" has been updated
     $ sudo apt-get update 
  2. Upgrade the distribution
     $ sudo apt-get dist-upgrade 
    • Type "Y" to install all the required Packages
  3. IMPORTANT: at some point in the install, you will be asked to update the rcS.d files. As the WSL has some "magic" in it, I choose to keep it as is. Really not sure if this would have an incidence or not.
    • Therefore, type "N" or just enter as it is the default when prompted for the update.
And that's actually all. It took my old pc (elitebook 8470p 4g RAM) about 20 minutes for the upgrade.
In order to be ensure everything is properly applied, I rebooted windows, as I do not know (yet) how I can reboot the WSL instance (read pico-process) itself.

I confirmed in 2 ways that ubuntu was correctly installed:

And that's all for now. My next blog post will be about another crazy idea that I also put on twitter already: have Docker runtime in WSL to manage Docker Beta for Windows.

Hopefully, this (first) blog post will help or at least give ideas for one person at least.

Darth Nunix