2015年7月26日日曜日

Homesteadにログインする

ホスト環境(私の場合Mac)とフォルダが共有されているのは分かっていたが、シェルでログインするにはどうしたら良いのだろうかと調べてみるとこれがまた簡単。Vagrantって本当に凄いな。

vagrant sshと打てば良いらしい。

% vagrant ssh 
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.


なるほど、vagrant global-statusで取得したIDを指定しないといけないのね。

% vagrant global-status 
id       name    provider   state   directory                          
------------------------------------------------------------------------
884a4c3  default virtualbox running /Users/<username>/Homestead              

The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"


なるほど、これか。早速指定してみる。


% vagrant ssh 884a4c3 
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-24-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Tue Oct 21 14:52:42 2014 from 10.0.2.2

vagrant@homestead:~%

おお。これだけでログイン出来てしまった。凄い便利だな。

0 件のコメント:

コメントを投稿