improve the Vagrant VMs: bump RAM to 512 MB & correct forwarded ports

This PR bumps the VM RAM to 512 MB and corrects forwarded ports when they're already used.

The bump to 512 MB of RAM is conservative. We could bump it higher to 640 MB or to 768 MB.


Thanks to @wouterd for the auto-correct of forwarded ports he proposed in #3042.

- [x] bump RAM to 512 MB
- [x] add an environment variable to set the amount of RAM the Vagrant VirtualBox VM should have
- [x] set auto_correct for forwarded ports to help with some conflicts
- [x] change the starting range of the forwarded ports from 49000 to 49153
- [x] enable memory cgroup and swap accounting
- [x] rebase after merging #3188
- [x] rebase after merging #3125
- [x] add support for setting the number of cores

~~come up with a workaround to the tmpfs problem to make it possible to test Docker with 512 MB of RAM~~ delayed for another PR