3 ms·
Ask HN: How Easy Would It Be to Replace Docker with VirtualBox?
The reason I use Docker is that I can quickly run sandboxed code and have it access a local folder:
docker run -v $PWD:/somedir --rm someimage somecode /somedir
I wonder if that is actually a new thing Docker introduced or if a similar command line exists for VirtualBox?
- i0nutzb 8y agoThe 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 8y agoHow 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 8y agowhat 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