表題を知りたい。
■ 環境
- Vagrant 1.9.4
- Mac OSX El Capitan
■ vagrant box list
Boxは下記のように複数のversionをまだ持っている。
$ vagrant box list
bento/centos-6.7 (virtualbox, 2.2.7)
centos/7 (virtualbox, 1608.02)
ubuntu/trusty64 (virtualbox, 20170222.0.0)
ubuntu/trusty64 (virtualbox, 20170405.0.0)
ubuntu/xenial64 (virtualbox, 20170331.0.0)
ubuntu/xenial64 (virtualbox, 20170419.0.0)
$
現在稼動しているVMが”ubuntu/xenial64“を使用しているのであるが、どちらのversionのBoxを利用しているのかを知りたい。何か良い手段はないものだろうか?とコマンドを探るも得られそうなコマンドがない。下記のように`suspend`->`up`としてみた。
$ vagrant suspend
==> default: Saving VM state and suspending execution...
$
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: A newer version of the box 'ubuntu/xenial64' is available! You currently
==> default: have version '20170419.0.0'. The latest is version '20170508.0.0'. Run
==> default: `vagrant box update` to update.
==> 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:2222
default: SSH username: ubuntu
default: SSH auth method: password
==> 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.
$
現在ローカルにある最新のversionは”20170419.0.0“で、最新の”20170508.0.0“がリリースされているよと教えてくれているようであるが、確かにローカルの最新は”20170419.0.0“ではあるのだが実際に稼動しているVMが使用しているBoxは”20170331.0.0“であるようだ…。というのも下記を実行した時のメッセージによる。
$ vagrant box prune
The following boxes will be kept...
bento/centos-6.7 (virtualbox, 2.2.7)
centos/7 (virtualbox, 1608.02)
ubuntu/trusty64 (virtualbox, 20170405.0.0)
ubuntu/xenial64 (virtualbox, 20170508.0.0)
Checking for older boxes...
Box 'ubuntu/xenial64' (v20170331.0.0) with provider 'virtualbox' appears
to still be in use by at least one Vagrant environment. Removing
the box could corrupt the environment. We recommend destroying
these environments first:
default (ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
Are you sure you want to remove this box? [y/N] N
Removing box 'ubuntu/xenial64' (v20170419.0.0) with provider 'virtualbox'...
$
この表記によると、現在はまだ”v20170331.0.0“で動いているからこいつを先に停止してからにしろよ、と理解した。しかし現時点ではまだ`destroy`したくはないVMである。`vagrant reload`を実行しても変化はなかった。作り直すのが手っ取り早いのであろう…。VMであるからそれは当然といえば当然なのだが…さてどうしたものか。
というわけで本題のBoxのversionを知りたいのだが、まだ解決できずである。
VMのあるディレクトリ配下の下記ファイルを確認したがパッと見ではよくわからない。
$ ls -1 .vagrant/machines/default/virtualbox/
action_provision
action_set_name
creator_uid
id
index_uuid
private_key
synced_folders
$
今後に持ち越しである。
以上。