Yes you are absolutely correct. You need to install VirtualBox first of all.
You can do it by running yum install virtualbox for CentOS or
sudo apt-get install virtualbox for Ubuntu
Do so and then run your code and you will be good to go
It’s an issue with permissions. You’ve installed docker as sudo. You need to run
sudo docker-machine create –driver virtualbox host1
OR
sudo docker-compose up
to get around this.