LoginSignup
61
61

More than 5 years have passed since last update.

Vagrant CloudにBoxを公開する

Last updated at Posted at 2014-03-11

Vagrant Cloudがリリースされたので、自分のBoxの公開を試してみた。

試した環境

  • Max OSX 10.9.1
  • Vagrant 1.5.0

Vagrant 1.5.0以上が必要。

リポジトリへのBoxの配置

Vagrant Cloudは、それ自体がBoxのリポジトリとなるわけではなく、Boxのリポジトリを仲介するようなイメージとなる。

そのため、まずはBoxを公開されている任意場所に配置する必要がある。

Boxの作成

こちらを参考に、任意状態の仮想マシンをPackageする
Vagrantのboxに少しだけ手を加えたものをboxとして取っておきたい

Boxをリポジトリへ配置

Packageして作成したBoxを、インターネット上へ公開されている任意リポジトリへ配置する。
DropBoxを利用して公開するとエラーとなる(後述)ので、Amazon S3上へ配置した。

Vagrant CloudへのBox作成

アカウントの登録

アカウント登録すると、Git Hubのような感じで自分の領域が割り当てられる。

Boxの作成

任意名前でBoxを登録する。

スクリーンショット 2014-03-11 17.50.51.png

Versionの作成

一つのBoxの中に複数のバージョンを管理できるので、バージョンを指定する。

kobito.1394528012.477156.png

バージョンの付け方は、Semantic Versioningが推奨されている。

Providerの作成

PackageしたBoxのproviderを選択し、Boxを配置したリポジトリのURLを指定する。

kobito.1394528243.467190.png

Provider作成後は、Releaseして完了となる。

kobito.1394528353.826023.png

Vagrant Cloudへ公開されたBoxを使用する

Boxの利用は、今までのVagrantの利用方法と同じ。

initコマンドで、Vagrantfileを作成する。
Boxには、Vagrant Cloudで登録した名称を指定する。

$ vagrant init ymori/sample

vagrant up すると、リポジトリからのダウンロードが始まり、Boxが追加され、VMが起動する。

$ vagrant up

ちなみに、Dropboxをリポジトリとして使用するとエラーが出る。

$ vagrant up
・・
==> default: Error downloading: An error occurred while downloading the remote file. The error
==> default: message, if any, is reproduced below. Please fix this error and try
==> default: again.
==> default: 
==> default: HTTP server doesn't seem to support byte ranges. Cannot resume.

どうやら、httpサーバがbyte-rangeリクエストをサポートしている必要がある見たい。

感想

Vagrantbox.esとくらべて、バージョン管理ができるし、長いURLを打つ必要もないので、今後はこちらが利用されることになりそう。

61
61
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
61
61