环境:腾讯云测试成功
1.条件:本地主机A和远程主机B
2.远程主机B,配置免密登录
1,在本地主机A上生成公钥和私钥,生成命令:ssh-keygen -t rsa
私钥:id_rsa 公钥:id_rsa.pub
2. 把生成的公钥添加到远程主机B的认证配置中,命令:
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
3.在本地主机操作,完成创建远程主机B的docker环境
例子1:docker-machine create -d generic \--generic-ip-address=192.168.22.175 \--generic-ssh-user=root \--engine-registry-mirror http://ef017c13.m.daocloud.io \dockerhost 例子2:
docker-machine create --driver generic --generic-ip-address=203.0.113.81 --generic-ssh-key ~/.ssh/id_rsa vm
成功后用如下命令即可实现本地docker客户端,连接远程docker服务端daeman,用命令exit可退出远程的docker环境:
eval $(docker-machine env machinename)
4.在本地端A可查看已安装节点
docker-machine ls
原文地址:https://www.cnblogs.com/spotatoman/p/10987529.html
时间: 2024-11-08 22:55:07