
Ask HN: How Easy Would It Be to Replace Docker with VirtualBox? - TicklishTiger
The reason I use Docker is that I can quickly run sandboxed code and have it access a local folder:<p>docker run -v $PWD:&#x2F;somedir --rm someimage somecode &#x2F;somedir<p>I wonder if that is actually a new thing Docker introduced or if a similar command line exists for VirtualBox?
======
i0nutzb
The advantage of running docker is that you don't virtualize things =>
everything is faster (boot time, access files and so on). (assuming you're
runing on a Linux machine)

In Virtual Box you have this „Shared Folders” which basically acts the same (I
have no idea if/how you can do this via CLI though). But the access to that is
done via SMB, so even if everything is local, you'll have some latencies
involved.

~~~
TicklishTiger
How much faster is everything?

If running code via Docker takes 10ms and via VirtualBox it takes 40ms that
would make no difference at all, even though it is 4x slower.

------
cabraca
what you have to consider is, that docker does not emulate hardware and does
not run a complete OS inside. that said you can definitly do something in that
direction with virtualbox:

create an .ova file as a template for your sandbox.

to "spin up" your sandbox you have to import that image, add a shared folder
and start it headless:

    
    
      vboxmanage import yourtemplate.ova --vsys 0 --vmname yourvmname
      vboxmanage sharefolder add "yourvmname" - name "SF name" -hostpath "x:\path" 
      vboxmanage startvm yourvmname --type headless
    

or something like that. You can find most of that stuff in Chapter 8 of the
VirtualBox docs:
[https://www.virtualbox.org/manual/ch08.html](https://www.virtualbox.org/manual/ch08.html)

