mfthomps / Labtainers

Labtainers: A Docker-based cyber lab framework
https://nps.edu/web/c3o/labtainers
264 stars 65 forks source link

Running Labtainers over Windows (10) #9

Closed olberger closed 3 years ago

olberger commented 6 years ago

This issue merely a reference point regarding private discussions, for future reference.

There seem to be some interest for people wishing to run labtainers over Windows 10.

As an alternative to the standard documented install inside a VirtualBox VM, which works on Windows, an alternative may be to run Labtainers from within a container, once Docker for Windows is installed. See https://github.com/mfthomps/Labtainers/issues/1 for details.

In addition, XMing, or another X window display server for Windows will be needed.

The resulting script looks like this in Windows PowerShell:

 & 'C:\Program Files (x86)\Xming\Xming.exe' :0 -ac -clipboard -multiwindow 

-ac means : without access control

$DISPLAY = ( `
      Get-NetIPConfiguration | `
      Where-Object { `
          $_.IPv4DefaultGateway -ne $null `
          -and `
          $_.NetAdapter.Status -ne "Disconnected" `
      } `
  ).IPv4Address.IPAddress + ":0"

docker run --rm -i -t --name docker0 -v /var/run/docker.sock:/var/run/docker.sock -e DISPLAY=$DISPLAY olberger/labtainer.master:latest /bin/bash

This uses the pre-built olberger/labtainer.master container image (available on dockerhub) which contains an installation of Labtainers made with the Dockefile referenced in https://github.com/mfthomps/Labtainers/issues/1#issuecomment-385522592

Surprisingly this works almost as on Linux...

Beware to security issues with such a privileged container being able to mess with other containers.

nathanmuccino commented 5 years ago

I was wondering if something like this would be possible or not. It's nice to see that it apparently is! Do note though, that I believe docker can only be directly installed on Windows 10 Pro edition not Windows 10 Home edition (wouldn't be a problem for me personally, as I always run the Pro edition of Windows). My main concern though would be whether or not the direct docker method would actually provide the exact same experience and compatibility that each lab intends to provide.

mfthomps commented 3 years ago

Labtainers now runs on Docker Desktop on either Windows or Macs. See the Student Guide for instructions.