I have a spring application which is compileable/runs on vagrant and listens to localhost:8080
(inside vagrant).
This is my Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network :forwarded_port, guest: 80, host: 9000, host_ip: "127.0.0.1"
config.vm.provision :shell, path: "bootstrap.sh"
end
Now I want to access my spring-application from the host machine via localhost:9000
.
Anyway the forwarded_port
line doesn't work and I really have no idea why?
What do I have to change in my Vagrantfile?
SOLUTION:
With the Vagrantfile
below it works for me.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.provider "virtualbox" do |v|
v.destroy_unused_network_interfaces = true
v.memory = 2048
v.cpus = 4
end
end