如何SSH进入Vagrant 1.6 Docker Provider设置的boot2docker主机vm? [英] How do I SSH into the boot2docker host vm that the Vagrant 1.6 Docker Provider sets up?
问题描述
- 获取访问权限,我在OSX上,我希望能够SSH进入主机vm到一个本地的码头环境。这有助于理解和调试端口转发问题。
- Vagrant rsync似乎留下了许多未使用的同步目录,正在吞噬我想要恢复的磁盘空间。要清楚的是,这个问题不是关于ssh进入Vagrant提供商创建的Docker容器,而是进入中间的boot2docker Vagrant创建的主机vm。
我知道解决方法是不要将默认的boot2docker用作主机vm(如答案这里),但这不是这个问题。
解决方案Vagrant的boot2docker保持boot2docker的ssh用户名和密码。
h3>
$ boot2docker ssh
Boot2Docker使用生成的SSH密钥自动登录,但如果要手动将SSH登录到
(或者您没有使用boot2docker
管理的虚拟机),凭据是:用户:docker
pass:tcuser
https://github.com/boot2docker/boot2docker#ssh-into-vm
默认情况下,端口从本地端口
2022
转发。您可以验证这一点:$ VBoxManage list vms | grep docker
docker-host_default_1234567890000_1234{3d66ecf6-4539-47ca-afd2-66f953cd9a3e}
$ VBoxManage showvminfo docker-host_default_1234567890000_1234 | grep ssh
NIC 1规则(1):name = ssh,protocol = tcp,host ip = 127.0.0.1,host port = 2022,guest ip =,guest port = 22
然后登录:
$ ssh docker @ localhost -p 2022
pre>
docker @ localhost的密码:tcuser
##。
## ## ## ==
## ## ## ## ===
/\ ___ / ===
~~~ {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ b \ \ __ /
\ ____ \ ______ /
_ _ ____ _ _
| | __ ___ ___ | | _ | ___ \ __ | | ___ ___ | | _____ _ __
| '_ \ / _ \ / _ \ | __ | __)/ _` | / _ \ / __ | | / / _ \'__ |
| | _)| (_)| (_)| | _ / __ /(_ | |(_)|(__ | <__ / |
| _.__ / \ ___ / \ ___ / \__ | _____ \ __,_ | \\ ___ / \ ___ | _ | \_\ ___ | _ |
boot2docker:0.8.0
docker @ boot2docker:〜$
I'm on OSX and I'd like to be able to SSH into the host vm in order to:
- Get access to a native docker environment. This facilitates understanding and debugging port forwarding issues.
- Vagrant rsync seems to leave a lot of unused synced directories that's eating up disk space that I'd like to recover.
To be clear, this question is NOT about ssh:ing into the docker containers that the Vagrant provider creates, but into the intermediate boot2docker host vm that Vagrant creates.
I know that a workaround is to not use the default boot2docker as the host vm (as explained in the answer here), but that's not what this question is about.
解决方案Vagrant's boot2docker keeps boot2docker's ssh username and password.
SSH into VM
$ boot2docker ssh
Boot2Docker auto logs in using the generated SSH key, but if you want to SSH into the machine manually (or you're not using a
boot2docker
managed VM), the credentials are:user: docker pass: tcuser
https://github.com/boot2docker/boot2docker#ssh-into-vm
The port is forwarded from the local port
2022
by default. You can verify this:$ VBoxManage list vms | grep docker "docker-host_default_1234567890000_1234" {3d66ecf6-4539-47ca-afd2-66f953cd9a3e} $ VBoxManage showvminfo docker-host_default_1234567890000_1234 | grep ssh NIC 1 Rule(1): name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 2022, guest ip = , guest port = 22
And then login:
$ ssh docker@localhost -p 2022 docker@localhost's password: tcuser ## . ## ## ## == ## ## ## ## === /""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\______/ _ _ ____ _ _ | |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __ | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__| | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ | |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_| boot2docker: 0.8.0 docker@boot2docker:~$
这篇关于如何SSH进入Vagrant 1.6 Docker Provider设置的boot2docker主机vm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!