When comparing Virtual Box vs Docker, the Slant community recommends Docker for most people. In the question“What are the best desktop virtualization solutions?” Docker is ranked 2nd while Virtual Box is ranked 3rd. The most important reason people chose Docker is:
Docker creates a single object, containing an application with its dependencies, that can be moved between any docker-enabled machines, guaranteeing the same environment for application execution.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Compatible with Many Operating Systems
It works for Windows, macOS, Linux, BSD, and many others.
Pro Beginner friendly
A virtual machine can be set up in minutes if a ISO file to load is already available.
Pro Works well and fast for Windows host and Linux guest
Pro Free and open source
Pro Many free images available
Though most are linux flavors at https://virtualboxes.org/
Oracle's virtualbox site has others.
Pro Can do snapshots
Pro A lot of customization
VirtualBox has multiple virtualization options. Each one may be tailored to the guest operating system’s needs. This makes it especially good on virtualizing older systems, such as DOS, obscure distros, etc.
Pro Allows for portable application deployment
Docker creates a single object, containing an application with its dependencies, that can be moved between any docker-enabled machines, guaranteeing the same environment for application execution.
Pro Git-like capabilities
Docker tracks changes in systems. It allows for commits and rollbacks and for quick deployment due to having to deploy only the updated code.
Pro Allows re-using components
Docker essentially allows creating boilerplate systems (a LAMP stack, for example) that can be used as a starting point on multiple projects. And you can find multiple such containers already created by people in their public registry.
Pro Automatic build
Allows automatically assembling a container from its source code.
Pro Provides easy sharing and installation of containers through a public registry
Docker allows easily pushing and pulling containers to and from their public index.docker.io registry. Additionally, dotCloud maintains a list of official repositories of the more popular containers.
Pro Application-centric
Pro Works in virtualized environments
You can set up Docker within an already virtualized environment such as a virtual machine. This allows you to run Docker on Mac and Windows, among other use-cases.
Pro Low overhead
Pro Supports a wide range of isolation tools
Docker can be used with OpenVZ, systemd-nspawn, libvirt-lxc, libvirt-sandbox, qemu/kvm, BSD Jails, Solaris Zones, and chroot.
Pro Tool ecosystem
Cons
Con Lacks video performance
Virtualbox has a hard cap of 256MB of video memory. This could make newer operating systems run slower.
Con Minimal CPU customization
You can only enable/disable certain features. You cannot cap the speed of the CPU, which is required to run systems such as Windows 95.