If you have about 15-20 minutes ahead of the lunch today go ahead and install WSL and Docker for Desktop
The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.
Note: You will be prompted to restart the machine after WSL feature is first installed. Choose not to restart until we have also installed Docker desktop.
Open a Powershell session as Administrator and run the following command:
## Powershell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
If you want to enable the feature via the GUI you will need to launch Server Manager.
- In the main dialog box you should see a link for Add features and roles. Click on that to start the install wizard 🔧.
- Select Role Based for the install type
- Select your local server
- Select Next on the Roles page
- In the Features options, scroll down and select Windows Subsystem for Linux
Note: You will be prompted to restart the machine after installing Docker desktop. So if you were tinkering with things save all your work before you log out.
## Powershell
Invoke-WebRequest -Uri https://download.docker.com/win/stable/Docker%20Desktop%20Installer.exe -OutFile DockerDesktop.exe -UseBasicParsing
.\DockerDesktop.exe
If for some reason the Powershell download appears stuck, just pop https://download.docker.com/win/stable/Docker%20Desktop%20Installer.exe
in to your browser and install it that way.
☕ ⏰
You can find supported images here on the WSL site. The rest of the guide assumes you're using Ubuntu 18 for the Virtual machine but most of the commands should translate to other (incorrect) operating system choices.
## Powershell
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing
Rename-Item .\Ubuntu.appx .\Ubuntu.zip
Expand-Archive .\Ubuntu.zip .\Ubuntu
Open up Windows explorer to C:\Users\Administrator\Ubuntu
and double click on the ubuntu1804.exe to start the install process. You will be prompted to create a linux system user and set a password. With those set you are now dropped in to your WSL shell.
Once the install completes go back to Powershell and run the following commands to set the ubuntu executable to be in our path:
## Powershell
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User")
Since we will likely be re-using these machines for future lunch and learns I would recommend installing the following tools. (at the very least install jq
to help with parsing JSON CLI output)
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install jq git build-essential unzip python3 python3-pip -y
Back in your WSL terminal
## WSL
curl -sL http://ibm.biz/idt-installer -o cli-installer.sh
chmod +x cli-installer.sh
./cli-installer.sh
sudo usermod -aG docker <your username>
If you want to run CLI commands within Powershell you will want to run the following commands:
## Powershell
[Net.ServicePointManager]::SecurityProtocol = "Tls12"; iex(New-Object Net.WebClient).DownloadString('https://ibm.biz/idt-win-installer')
We're now ready to start learning some IBM Cloud CLI commands
We're going to sign in with SSO for our initial login
$ ibmcloud login --sso
We will generate a CLI specific API key to use on the machine
$ ibmcloud iam api-key-create <name of key> -d "A description" --file ~/ibmcloud_api.json
So that we can simply login to the IBM Cloud CLI without having to go through the SSO dance everytime we will set the IBMCLOUD_API_KEY
store the environmental variable for future use.
$ echo "export IBMCLOUD_API_KEY=\"$(cat ~/ibmcloud_api.json | jq -r .apikey)\"" | tee -a ~/.bashrc
$ source ~/.bashrc
To make sure that our API key environmental variable is set properly we will log out and then back in:
$ ibmcloud logout
$ ibmcloud login -r us-south
- Show account details
$ ibmcloud account show
- List available plugins for the CLI
$ ibmcloud plugin repo-plugins
- List Classic Servers in Dallas 13
$ ibmcloud sl hardware list -d dal13
- Target a new region and list service-instances
$ ibmcloud target -r us-east
$ ibmcloud resource service-instances