Vagrant — Portable Development Environments Made Simple
Vagrant is a tool for building and managing portable development environments. Define your environment in a Vagrantfile, run vagrant up, and get a fully configured virtual machine — ensuring every developer works in an identical environment.
Instalación con revisión previa
Este activo requiere revisión. El prompt copiado pide dry-run, muestra escrituras y continúa solo tras confirmación.
npx -y tokrepo@latest install 69552a5c-3702-11f1-9bc6-00163e2b0d79 --target codexPrimero dry-run, confirma las escrituras y luego ejecuta este comando.
What it is
Vagrant is an open-source tool by HashiCorp for building and managing portable development environments. You describe your environment in a declarative Vagrantfile, run vagrant up, and get a fully configured virtual machine regardless of your host OS.
Vagrant is best suited for teams that need OS-level isolation beyond what containers provide. If you need to test on different kernels, run full system stacks, or develop software requiring kernel-level access, Vagrant remains the right choice.
How it saves time or tokens
Vagrant eliminates manual environment setup. Instead of writing a wiki page with 30 steps that each developer interprets differently, you commit a single Vagrantfile. New team members run vagrant up and get an identical environment in minutes. Provisioners (shell scripts, Ansible, Chef, Puppet) automate every configuration step, removing human error from the loop.
How to use
- Install Vagrant and a provider (VirtualBox is the default free option)
- Initialize a project with a base box:
mkdir my-project && cd my-project
vagrant init ubuntu/jammy64
- Start and connect to the VM:
vagrant up
vagrant ssh
- Customize the Vagrantfile for your stack (forward ports, sync folders, run provisioners)
Example
# Vagrantfile
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu/jammy64'
config.vm.network 'forwarded_port', guest: 3000, host: 3000
config.vm.synced_folder '.', '/vagrant'
config.vm.provision 'shell', inline: <<-SHELL
apt-get update
apt-get install -y nodejs npm
cd /vagrant && npm install
SHELL
end
Run vagrant up and your Node.js environment is ready with port 3000 forwarded to your host.
Related on TokRepo
- DevOps automation tools — broader category of infrastructure automation resources
- Self-hosted tools — other tools you can run on your own infrastructure
Common pitfalls
- Using VirtualBox on Apple Silicon Macs without switching to a compatible provider like VMware or Parallels
- Forgetting to add the Vagrantfile to version control, defeating the purpose of reproducible environments
- Over-provisioning VMs with too much RAM or CPU when the workload does not require it
Preguntas frecuentes
Vagrant manages full virtual machines with their own kernel, while Docker runs containers sharing the host kernel. Use Vagrant when you need OS-level isolation, kernel testing, or Windows/Linux cross-platform development. Use Docker when you need lightweight process isolation for microservices.
Vagrant supports VirtualBox (free, default), VMware (paid plugin), Hyper-V (Windows), Parallels (macOS), and cloud providers like AWS and Google Cloud. You choose a provider based on your host OS and performance requirements.
Yes. Vagrant can provision a VM that runs Docker inside it, or you can use the Docker provider to let Vagrant manage containers directly. This is useful for teams that want Vagrant's workflow but Docker's runtime.
Vagrant remains relevant for full-OS testing, multi-OS development, and scenarios where kernel-level access matters. It is not a competitor to Docker but serves a different use case: full machine virtualization with reproducible configuration.
Commit the Vagrantfile to your repository. Each developer runs vagrant up to build the same environment. For custom base boxes, host them on Vagrant Cloud or an internal HTTP server and reference them in the Vagrantfile.
Referencias (3)
- Vagrant Documentation— Vagrant supports VirtualBox, VMware, Hyper-V, and cloud providers
- Vagrant GitHub Repository— Provisioners include shell, Ansible, Chef, Puppet
- HashiCorp Vagrant— Vagrant is maintained by HashiCorp
Relacionados en TokRepo
Discusión
Activos relacionados
Eclipse Che — Cloud Development Environments for Kubernetes
Eclipse Che provides Kubernetes-native cloud development environments with browser-based IDEs, enabling teams to standardize and instantly provision developer workspaces.
CodeSandbox — Instant Cloud Development Environments
An online IDE and cloud dev environment platform that lets teams spin up full development setups in seconds directly from a repository.
Gitpod — Cloud Development Environments on Demand
Gitpod provides automated, pre-configured cloud development environments. Open a repository and get a ready-to-code workspace with VS Code or JetBrains in seconds.
mkcert — Zero-Config Local HTTPS Development Certificates
mkcert is a simple tool that creates locally-trusted development certificates with zero configuration. No more browser security warnings in local development — just run mkcert and get valid HTTPS for localhost and any custom domain.