- Start the guest machine
$ vagrant up
$ vagrant ssh
- Build docker container
$ cd /vagrant
$ sudo docker build -t <USERNAME>/rubybuild .
- rpmbuild in the container
$ sudo docker run --rm -it <CONTAINER> /bin/sh ./rubybuild.sh
- check the rpm file on virtual machine
$ ls *.rpm
ruby-2.0.0p481-2.el6.x86_64.rpm
Enjoy!