Skip to content

A docker image with all the stuff I need for teaching.

Notifications You must be signed in to change notification settings

DanySK/docker-linux-didattica

Repository files navigation

Manjaro Linux virtual machine for teaching

I'm tired of stuff not working with Windows and dual boots are apparently not a thing in my university, VMs drain too many resources, some students have Linux/Mac PCS... So I adopted docker

  • Link to the docker hub page
  • Quickly pull it via: docker pull danysk/docker-linux-didattica:latest

Run on linux

docker pull danysk/linux-didattica
docker run --rm --net=host --env="DISPLAY" -v <WHERE_TO_LOCALLY_PERSIST>:/home/user --volume="$HOME/.Xauthority:/.Xauthority:rw" -it danysk/linux-didattica

Run on Windows 10

Install VcXsrv, configure it as explained here.

On a cmd/powershell run ipconfig and find your IP address.

docker pull danysk/linux-didattica
set-variable -name DISPLAY -value <YOUR_IP>:0.0
docker run --rm "<WHERE_TO_LOCALLY_PERSIST>:/home/user" --volume="$HOME/.Xauthority:/.Xauthority:rw" -e DISPLAY=$DISPLAY -it danysk/linux-didattica

Import as a WSL2 distro

  • Download the *.tar.zstd.* files from the release page
  • Join them back into a single compressed archive:
    • Bash (requires a UNIX-like shell: sh, bash, zsh, fish... won't work on Powershell or Cmd): cat *.tar.zstd.* > wsl.tar.zstd
    • Cmd: copy /b wsl.tar.zstd.00 + wsl.tar.zstd.01 + wsl.tar.zstd.02 wsl.tar.zstd (add all the downloaded files)
  • Decompress the tarball into a wsl.tar file
    • If you have Z-standard installed, simply: unzstd wsl.tar.zstd
    • If unzstd is not installed, but you have access to zstd or zstd.exe, run: zstd -d wsl.tar.zstd
    • If you prefer a graphical tool, check out PeaZip
  • Import in WSL2 (replace PATH_TO_THE_WLS_FILE_SYSTEM with a valid path):
    • wsl --import didattica PATH_TO_THE_WLS_FILE_SYSTEM wsl.tar --version 2

Launch as WSL2 distro:

  1. Launch VcXsrv with the configuration mentioned before
  2. Use the Powershell command Get-NetIPAddress -AddressFamily ipv4 to get your IP address
  3. Run the following in Powershell, substituting <YOUR_IP> with your IP address:
$DISPLAY="<YOUR_IP>:0.0"
$env:DISPLAY=$DISPLAY
$env:WSLENV="DISPLAY/u"
wsl -d didattica -u user zsh

Run on Mac OS X

Prerequisites

  1. Install Docker following the instructions provided here
  • beware that Mac machines with Apple Chips require installing Rosetta first
  1. Install xquartz from Homebrew
brew install xquartz
  1. Reboot your Mac after installing xquartz

  2. Start the XQuartz application

  3. Open then preferences dialog of the XQuartz application, go to the Security section, and enable the flag Allow connections from network clients, as depicted below (more details here):

XQuartz preferences dialog, security tab

Running the container

  1. Start XQuartz application

  2. Run the following commands in your shell

export IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')

xhost +$IP

docker run --rm --name linux-didattica --net=host -e "DISPLAY=$IP:0" -e XAUTHORITY=/.Xauthority -v <WHERE_TO_LOCALLY_PERSIST>:/home/user --volume="$HOME/.Xauthority:/.Xauthority:rw" -v /tmp/.X11-unix:/tmp/.X11-unix -it danysk/linux-didattica