aaronbloomfield/pdr

VM vs Docker?

Closed this issue · 2 comments

Have you explored the possibility of using Docker rather than or in addition to a fully fledged VM?

The tradeoffs I can think off the top of my head are

Pros:

  • Experience with containers such as Docker (useful when applying to internships and what-not, even if they only ran docker run -it cs2150 or somesuch).
  • Ensuring 100% consistency for the class, i.e. Docker runs on OS X, Debian, CentOS, Windows, etc.
  • Ensuring consistency in the sense of one Dockerfile that has all the dependencies required for the course and a clean-slate to run it on. If anything should change during the semester, they can git pull and update their Dockerfile, which would then allow them to rebuild with minimal effort on all parties' parts.
  • It will force the students to really learn bash and get cozy with an editor (vim or emacs)
  • It has X-windows, so students can run Gedit or the Emacs GUI. An option here is to install a vncviewer which would allow them to even have a desktop environment (see: http://stackoverflow.com/questions/16296753/can-you-run-gui-apps-in-a-docker-container).
  • Less bloated than having to download a 1+ GB vdi.

Cons:

  • Docker has somewhat of a non-trivial learning curve.
  • It has been known to cause OSes to kernel panic on occasion.

Related: Windows 10 Anniversary Update (stable release next week on 2 August 2016) ships with Windows Subsystem for Linux (WSL), which affords a bash shell capable of compiling and running arbitrary native 64-bit ELF binaries (under a compatibility layer with the NT kernel -- so basically WINE in reverse) and has full access to Ubuntu/debian apt-get repository (the shell is a genuine 14.04 trusty tahr image released by Canonical). Would need some testing/tutorial writing by staff with access to WSL, but would likely be much faster to use/easy to set-up than the VM route for Windows 10 users.

ssh/scp'ing with the department lab servers has been a good alternate environment so far for PDR students with less-capable machines (but which do have ample network speed/connection for a productive ssh session).

I also like the Docker suggestion quite a bit, but I agree that it does impose an additional learning curve...perhaps a PDR-supported Dockerfile could be maintained for interested students wanting another official way to ditch the VM (I would be happy to look into creating one).

I'm going to close this issue because I don't think this is the best setup for 2150. I'm concerned too many students might miss that containers don't save state unless specifically told to (via docker commit) or volume-mounting directories (which wouldn't fly in the OLS 001 lab because of potential privilege escalation concerns).

In any case, here is the Dockerfile I envisioned. I'm leaving it here if anyone in the future wishes to pursue this further.

RUN apt-get update && \
    apt-get install -y \
        cmake \
        git \
        gcc \
        gobjc \
        gnustep-devel \
        gdb \
        clang-3.5 \
        lldb-3.5 \
        vim \
        emacs \
        python \
        build-essential && \
    apt-get clean && \
    ln -s /usr/bin/clang-3.5 /usr/bin/clang && \
    ln -s /usr/bin/clang++-3.5 /usr/bin/clang++ && \
    ln -s /usr/bin/lldb-3.5 /usr/bin/lldb

RUN useradd -ms /bin/bash cs2150

USER cs2150
WORKDIR /home/cs2150

CMD ["bash", "-l"]

Note: it doesn't clone the pdr repo. It is my understanding that this is the current behavior with the VMs as well, but it's a simple addition to the RUN command if not.