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