Vagrant 仮想マシンを一時停止する

Vagrant 仮想マシンを一時停止する

Vagrantで、仮想マシンを一時停止する手順を記述してます。「suspend」で可能です。起動したい場合は「resume」を使用します。

環境

  • OS windows11 Home
  • Vagrant 2.3.1

仮想マシンを一時停止

仮想マシンを一時停止するには、「suspend」コマンドを使用します。

> vagrant suspend

==> default: Saving VM state and suspending execution...

Virtual Boxの方も停止していることが確認できます。

再度起動するに「 resume 」を使用します。

> vagrant resume

==> default: Resuming suspended VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2201
    default: SSH username: vagrant
    default: SSH auth method: private key
==> 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.

boxを削除するには、まずは「box list」で一覧を確認してから対象を削除します。

> vagrant box list
boxomatic/centos-stream-9 (virtualbox, 20220921.0.1)
centos/7                  (virtualbox, 2004.01)

> vagrant box remove centos/7
Removing box 'centos/7' (v2004.01) with provider 'virtualbox'...