Basic Commands

Run the specified box

$ vagrant init ubuntu/xenial64

Use vagrant identity to access Guest

It use SSH key, as a result, no password is needed

$ vagrant ssh {NAME:Optional}
# 1. 正統登入法:用 vagrant 帳號 + vagrant 密碼來登入,並關閉 host key checking。
# 2. 正統登入法:用 vagrant 帳號 + private key 來登入,並關閉 host key checking。
# 3. 簡便登入法:用 vagrant ssh 指令登入。
# ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null [email protected] -p 2222
# password:vagrant

$ vagrant ssh-config
# Host default
#  HostName 127.0.0.1
#  User vagrant
#  Port 2200
#  UserKnownHostsFile /dev/null
#  StrictHostKeyChecking no
#  PasswordAuthentication no
#  IdentityFile /root/.vagrant.d/insecure_private_key
#  IdentitiesOnly yes
#  LogLevel FATAL
# ssh [email protected] -p 2200 -i /root/.vagrant.d/insecure_private_key

Stop/Terminate the Guest

Box Management (vagrant box)

vagrant box

Snapshot Management (vagrant snapshot)

vagrant snapshot

Configuration of VagrantFile

Last updated

Was this helpful?