Docker image that can be used as a provider for Vagrant
381
This is a docker image that can be used as a provider for Vagrant as a development environment.
This was inspired by Apple's introduction of the M1 chip which is ARM based. That means that solutions which use Vagrant and VirtualBox will not work on Apple M1 because VirtualBox requires an Intel processors. This lead me to find a solution for a virtual development environment that works with ARM and thus Apple M1 computers.
Docker has introduced the Apple M1 Tech Preview that runs Docker on Macs that have the Apple M1 chip. By using Docker as a provisioner for Vagrant, we can simulate the same experience as developers using Vagrant with VirtualBox.
This image is based on Ubuntu:20.04 and mimics the things that are needed for a valid vagrant box. This contains the vagrant userid with password-less sudo privileges. It also contains as sshd server. Normally, it is considered a bad idea to run an ssh server in a Docker container but in this case, the Docker container is emulating a Virtual Machine (VM) to provide a development environment so it makes perfect sense. ;-)
Here is a sample Vagrantfile that uses thus image:
Vagrant.configure("2") do |config|
config.vm.provider 'docker' do |docker, override|
override.vm.box = nil
docker.image = "rofrano/vagrant:ubuntu"
docker.name = "vagrant-docker"
docker.remains_running = true
docker.has_ssh = true
docker.create_args = ['--privileged']
end
end
To use this provider, add the --provider flag to your vagrant command:
vagrant up --provider=docker
This will use this docker image as the base box.
Content type
Image
Digest
Size
102.9 MB
Last updated
over 5 years ago
docker pull rofrano/vagrant:ubuntu