vagrant status网络
vagrant sshssh
在vagrantfile中添加共享文件配置.net
Vagrant.configure(2) do |config| config.vm.share_folder "v-root","/foo","." end
解释:vagrant
"v-root",主机地址code
"/foo",为虚拟机内地址,若是没有改目录活文件,会自动建立虚拟机
".",表示共享主机的文件配置
在vagrantfile中配置端口转发file
Vagrant::configure(2) do |config| config.vm.network "forwarded_port", guest:80, host: 8080 end
解析:vagrant将会使80端口的请求,转发至host machine的8080端口。network
vagrant reload请求
Open a browser to localhost:8080 on the host machine, and a directory listing of /vagrant, served from the guest machine, will be shown.
vagrant suspend
vagrant halt
vagrant halt --force
vagrant destroy
vagrant destroy --force