I want to create a self contained VM that reside in a folder on a windows computer.

When running, it requires no installation of VM software; and can run in the background, so I can send from Windows for example, files to be parsed (the idea is to send scripts made in python, c++ or shell script and get back the result after the scripts are compiled and executed)

Is this possible? I am working on a training program where users can learn to program in different languages, and in a totally sealed environment so they won't mess up their machines while experimenting.

The only thing I found are either single board hardware devices, running linux, or VM images that are big (I don't need anything but the compilers for the 3 languages and the base Linux OS) and require you to install VMWare or other similar software.

  • You have to have something installed to run virtual machines! – Michael Hampton Feb 17 at 2:09
  • I understand that; but couldn't it be already in the same folder in which the VM file is located? I would llike to have something that I can just place on a folder in documents for example, and when done, delete it – rataplan Feb 17 at 2:17
  • 2
    It doesn't work like that. Some kind of hypervisor must actually be installed and loaded at boot time. You can't do that with a "portable" setup. – Michael Hampton Feb 17 at 2:25
  • I see, so conceptually there is no way to put everything in a folder and run it locally on a machine, without install any software. Thanks for the info; I will need to find an alternative way to do this then, – rataplan Feb 17 at 3:01
  • If you can boot from USB, then a Linux live system with persistence (for additional software/user directories) might work for you. There you can install virtualization software like VirtualBox if needed. Fast USB3.0 drives are cheap nowadays. – Freddy Feb 17 at 3:41

You could use a browser to emulate Linux. There are some distributions that include compilers and executable to interpreted languages like python and perl.

Some examples:

Have fun and happy coding!

  • This is an interesting solution; it require to be connected to the outside network; which I was not planning to, for our training sessions, but seems much easier to script a browser to point to these browser installations ! Is there a way to run one of these locally? I could easily set up a system that trigger a web server running on the local machine, which would host the linux terminal. I don't mind to spend efforts in coding the setup, as long as I can run it locally. Otherwise, I can leverage on the online solution, although then there are issues related to safety and security. – rataplan Feb 25 at 2:07
  • 1
    There is an open source solution called copy.sh. You could download it and run it local. – Joffrey Feb 25 at 13:04

You could run Linux or Windows containers on Windows, an option for isolated, self contained, lightweight environments. It does require Hyper-V + docker, so does not meet your no install requirement.

Or, consider running a CI/CD type service were you centrally host the build/test/deploy infrastructure. Reproducible builds, but tricky to scale to a classroom of people, and developers still need a local environment to debug things.

  • Indeed; the options here are all very involved, and require me to actually tap in the computers to set them up; versus just give a folder with everything in it and double click on the app to run the VM. Thanks for your insights – rataplan Feb 25 at 2:05

You can’t do that in a VM without installing a hypervisor of some sort, but modern Windows versions provide the Windows Subsystem for Linux (WSL) that might be used in the way you describe if you set up a user friendly wrapper to send files between the user’s directory and the WSL working directory. Another alternative might be to run Cygwin that also provides a Unix-like shell in Windows.

Both require installation, but are significantly less resource intensive than a hypervisor+VM.

  • How close to the "real thin" would WSL be? Can I use apt-get or other package managers to run on and install things like python or GCC? – rataplan Feb 25 at 2:03
  • 1
    To be honest I've only tested WSL for a few minutes on a borrowed Win 10 laptop when my Mac was being serviced, so I haven't got a lot of experience with it. But yes, if you install WSL and the Ubuntu package you can run apt-get to install programs pretty much as you'd expect. Links to Microsoft's own information: microsoft.com/en-us/p/wsl-guideline/…, microsoft.com/en-us/p/ubuntu-1804-lts/… – Mikael H Feb 25 at 9:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.