LoginSignup
21
23

More than 5 years have passed since last update.

boot2docker で作った VM に ssh で接続する方法

Posted at

boot2docker ssh を使う

ドキュメントに書いている標準的な使い方です。

% boot2docker ssh

ssh コマンドを使う

boot2docker ssh 内で行われていると思われるコマンドです。

% ssh docker@localhost -p 2022 -i ~/.ssh/id_boot2docker

boot2docker は VM への ssh ポートをホスト OS の 2022 にポートフォワーディングしています。
また、ssh で使用するパスフレーズなしの秘密鍵は ~/.ssh/id_boot2docker に生成されています。
(なお、鍵を使わない場合は user:docker password:tcuser でログインできます)

scp の使い方

ssh の接続方法が明らかになったので、scp など ssh を使った他のコマンドも用いることができます。

次の例はホスト OS 側にある local_file を VM 側にある remote_file という名前にして転送しています。

% scp -P 2022 -i ~/.ssh/id_boot2docker local_file docker@localhost:remote_file
21
23
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
21
23