LoginSignup
3
5

More than 5 years have passed since last update.

Vagrant コマンドメモ

Posted at

Vagrantの基本コマンドをメモとして残す。

Vagrant

確認 : $ vagrant status

vagrantでの現状ステータスを表示します。
※初期ステータス : poweroff

$ vagrant status

  Current machine states:

  default                   poweroff (virtualbox)

  The VM is powered off. To restart the VM, simply run `vagrant up`

起動 : $ vagrant up

vagrantを起動する。
ステータス : running

$ vagrant status
  Current machine states:

  default                   poweroff (virtualbox)

  The VM is powered off. To restart the VM, simply run `vagrant up`


$ vagrant up
  Bringing machine 'default' up with 'virtualbox' provider...
  // 省略


$ vagrant status
  Current machine states:

  default                   running (virtualbox)

  The VM is running. To stop this VM, you can run `vagrant halt` to
  shut it down forcefully, or you can run `vagrant suspend` to simply
  suspend the virtual machine. In either case, to restart it again,
  simply run `vagrant up`.

ログイン : $ vagrant ssh

vagrantにsshでログインする。
vagrant起動$ vagrant up後に実行する。
ステータス : running

$ vagrant status

  Current machine states:

  default                   running (virtualbox)

  The VM is powered off. To restart the VM, simply run `vagrant up`


$ vagrant ssh
  Last login: Mon Jan 15 16:39:43 2018 from 10.0.2.2

一時停止 : $ vagrant suspend

vagrantを一時停止する。
vagrantからログアウト後に実行する。
ステータス : saved

$ vagrant status
  Current machine states:

  default                   running (virtualbox)

  The VM is running. To stop this VM, you can run `vagrant halt` to
  shut it down forcefully, or you can run `vagrant suspend` to simply
  suspend the virtual machine. In either case, to restart it again,
  simply run `vagrant up`.


$ vagrant suspend
  ==> default: Saving VM state and suspending execution...


$ vagrant status
  Current machine states:

  default                   saved (virtualbox)

  To resume this VM, simply run `vagrant up`.

再起動 : $ vagrant resume

vagrantの状態を一時停止から再起動する。
一時停止$ vagrant suspendの状態において、再起動が実行可能。

$ vagrant status
  Current machine states:

  default                   running (virtualbox)

  The VM is running. To stop this VM, you can run `vagrant halt` to
  shut it down forcefully, or you can run `vagrant suspend` to simply
  suspend the virtual machine. In either case, to restart it again,
  simply run `vagrant up`.


$ vagrant suspend
  ==> default: Saving VM state and suspending execution...


$ vagrant status
  Current machine states:

  default                   saved (virtualbox)

  To resume this VM, simply run `vagrant up`.


$ vagrant resume
  ==> default: Resuming suspended VM...
  ==> default: Booting VM...
  ==> default: Waiting for machine to boot. This may take a few minutes...
  ==> default: Machine booted and ready!
  ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
  ==> default: flag to force provisioning. Provisioners marked to run always will still run.


$ vagrant status
  Current machine states:

  default                   running (virtualbox)

  The VM is running. To stop this VM, you can run `vagrant halt` to
  shut it down forcefully, or you can run `vagrant suspend` to simply
  suspend the virtual machine. In either case, to restart it again,
  simply run `vagrant up`.

停止 : $ vagrant halt

vagrantを停止する。
vagrantからログアウト後に実行する。
ステータス : poweroff

$ vagrant status
  Current machine states:

  default                   saved (virtualbox)

  To resume this VM, simply run `vagrant up`.


$ vagrant halt
  ==> default: Discarding saved state of VM...


$ vagrant status
  Current machine states:

  default                   poweroff (virtualbox)

  The VM is powered off. To restart the VM, simply run `vagrant up`
3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5