Vagrant proxy configuration


In this tutorial, How to use Vagrant proxy configuration on the Virtual machine. To configure a proxy for Vagrant, you can use the Vagrant Proxy Configuration options.

The Vagrant plugin can set:

  • generic http_proxy
  • proxy configuration for Docker
  • proxy configuration for Git
  • proxy configuration for npm
  • proxy configuration for Subversion
  • proxy configuration for Yum
  • etc.

Install Vagrant Plugin vagrant-proxyconf

This plugin requires Vagrant version 1.2 or newer

vagrant plugin install vagrant-proxyconf

The output terminal is as below:

Install Vagrant Plugin vagrant-proxyconf

To configure all Vagrant VMs

Vagrant.configure("2") do |config|
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://IP-ADDRESS:3128/"
    config.proxy.https    = "http://IP-ADDRESS:3128/"
    config.proxy.no_proxy = "localhost,,,"
  # ... other stuff

Environment variables


These also override the Vagrantfile configuration.

For example, Vagrant runs the command below:

VAGRANT_HTTP_PROXY="" vagrant up

Disabling the plugin

config.proxy.enabled         # => all applications enabled(default)
config.proxy.enabled = true  # => all applications enabled
config.proxy.enabled = { svn: false, docker: false }  # => specific applications disabled
config.proxy.enabled = ""    # => all applications disabled
config.proxy.enabled = false # => all applications disabled

Example Vagrantfile

Vagrant.configure("2") do |config|
  config.proxy.http = ""

  config.vm.provider :my_devopsroles do |cloud, override|
    override.proxy.enabled = false
  # ... other stuff

My Example, the Vagrant proxy configuration

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.define "myserver" do |myserver| = "ubuntu/impish64"
    myserver.vm.hostname = "" "private_network", ip: "" "forwarded_port", guest: 80, host: 8080
    myserver.vm.provider :virtualbox do |v|
	  v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
	  v.customize ["modifyvm", :id, "--memory", 1024]
	  v.customize ["modifyvm", :id, "--name", "myserver"]
    if Vagrant.has_plugin?("vagrant-proxyconf")
      config.proxy.http     = ""
      config.proxy.https    = ""
      config.proxy.no_proxy = "localhost,,,"

Vagrant proxy configuration

Via Youtube


You have configured a proxy for your Vagrant environment. Make sure to adapt the proxy settings according to your specific proxy server configuration. I hope will this your helpful. Thank you for reading the DevopsRoles page!


About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.