LoginSignup
4
4

More than 5 years have passed since last update.

Vagrantfileでhostnameを指定したときのメモ

Posted at

hostnameの指定

config.vm.hostname でHost名を変更できるんですが、"_" (アンダーバー)はダメな模様。
ハイフンは大丈夫でした。

hostnameにハイフンを入れた場合….

Vagantfileで、"test_vm" と設定してみます。

  • exp. config.vm.hostname = "test_vm"

すると、こんなエラーメッセージが出ました。

% vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The hostname set for the VM should only contain letters, numbers,
hyphens or dots. It cannot start with a hyphen or dot.

良く読むと、ちゃんと理由が書かれていますね。(最初はこの英語のメッセージに気がつきませんでした…)

ちなみに、このあたりのIssueで扱っていました。

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