Subscribed unsubscribe Subscribe Subscribe

hasen's tech life

Twitter: @hasen

Vagrant packageで作業を短縮する

Vagrant

# 年末年始,ぼけっとコマンドラインのヘルプを読んでいると便利なものを見つけた.
# 毎回`yum update`などしているので,その時間がもったいない.予めboxにしておく.
# 公開までしなくても,自分のよく使う便利なところで止めて,box化しておけばよかったのだ.

$ vagant --help
... (略)
> package packages a running vagrant environment into a box
... (略)

$ vagrant ssh
$ DO SOMETHING
$ exit
$ vagrant package
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Exporting VM...
==> default: Compressing package to: /PATH/TO/package.box

$ vagrant box add NEW_BOX_NAME ./package.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'NEW_BOX_NAME' (v0) for provider:
box: Unpacking necessary files from: file:///PATH/TO/package.box
==> box: Successfully added box 'NEW_BOX_NAME' (v0) for 'virtualbox'!