Skip to content

Hub CTL on Windows

Igor Lysak edited this page Sep 28, 2022 · 2 revisions

Native hub.exe

This is the easiest option in case you just want to call Hub CTL from command-line.

Download latest release, unzip it, put hub.exe in PATH, and you're done with the install.

Windows Subsystem for Linux

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 virtual machine.

Here we're assuming WSL 1 which is different from WSL 2. WSL 2 is a true virtual machine (Hyper-V) but it is still work in progress on Microsoft side - the experience is not so polished as with WSL 1, and you must have Windows 10 build 18917 or later from the Windows Insider Program.

WSL could be installed from Microsoft Store. The examples below are given for the Ubuntu Linux distribution.

After Linux distribution is installed and initial user is configured, download and install hub:

curl -LJ "https://github.com/epam/hubctl/releases/latest/download/hub_$(uname -s)_$(uname -m).tar.gz" | tar xz -C /tmp
sudo mv /tmp/hub /usr/local/bin

Note, that this only gives you hub, yet actual software provisioning from local machine requires quite a bit of additional provisioning tools - such as Terraform, kubectl, Helm, etc., that you must install separately.

Inside WSL C:\ is mounted under /mnt/c so it is straightforward to share files between Linux and Windows.

Hub CTL extensions

Hub CTL is extendable via scripts. There is a number of well-know extensions, such as hub pull, hub ls, etc. hosted in hub-extensions.

To install:

hub extensions install

epam/toolbox with Docker Desktop

This is the most advanced and out-of-the-box feature-rich option.

Install Docker Desktop.

We recommend to also install Windows Terminal from Microsoft Store for better terminal experience - tabs, etc.

Powershell script

This script launches Toolbox container. You should go into Docker Desktop Settings > Resources > File Sharing and make drive C available to your containers > Apply & Restart.

Save the script as toolbox-run.ps1:

$IMAGE = "agilestacks/toolbox:stable"
$TOOLBOX_SHELL = "/bin/bash"

$BASEDIR = (pwd).Path
$USER    = $env:UserName
$HOMEDIR = "/home/$USER"
$WINHOME = "C:\Users\$USER"
$homevol = "{0}:{1}" -f "$WINHOME", "$HOMEDIR"
$basevol = "{0}:{1}" -f "$BASEDIR", "/workspace"

echo $homevol
echo $basevol

& "C:\Program Files\Docker\Docker\resources\bin\docker.exe" run -ti --rm `
-h toolbox-"$env:computername" `
-e "USER=$USER" `
-e "UID=1000" `
-e "GID=1000" `
-e "HOME=$HOMEDIR" `
-e "SHELL=$TOOLBOX_SHELL" `
-e 'PS1=\u@\e[92m\h\e[0m \w $ ' `
-v "$homevol" `
-v "$basevol" `
--privileged=true `
--cap-add=NET_ADMIN `
-w "/workspace" `
"$IMAGE" "$args"

echo "Shutting down toolbox... bye!"

Run it and a PowerShell terminal window will open. The Toolbox is rather large image over 1GB size compressed so it will take a while to download an unpack first time.

Current directory will be mapped to /workspace and your Windows user home directory to /home/<user name>.

Clone this wiki locally