使用带有ssh隧道的远程docker。
docker-tunnel的Python项目详细描述
docker-tunnel是一个控制台实用程序,用于使用带有ssh隧道的远程docker。
如果您使用的是OS X或Linux发行版,但不支持Docker内核, 不再运行虚拟机或远程shell的ssh。
用法
$ docker-tunnel user@example.com (user@example.com) $ (user@example.com) $ echo $DOCKER_HOST 127.0.0.1:4243 (user@example.com) $ docker ps # go ahead ... (user@example.com) $ ^D # ctrl-d $
更多选项:
$ docker-tunnel --help
外壳主题集成
在隧道注入的shell中,将分配环境变量DOCKER_HOST和DOCKER_PROMPT_INFO。它们可以在shell主题中用于提示您正在使用哪个隧道。
有一个例子,my custom theme表示oh-my-zsh。
故障排除
- Error response from daemon: client and server don't have same version (client : 1.14, server: 1.12)
CentOS 7源中的Docker正在使用API 1.12,但OS X自制中的Docker客户端没有。您可以使用自制程序降级Docker客户端:
$ brew versions docker ... 1.0.0 git checkout c513c42 /usr/local/Library/Formula/docker.rb ... $ cd /usr/local/Library/Formula # now we install the old version of docker $ git checkout c513c42 -- docker.rb $ brew unlink docker $ brew install docker $ git checkout HEAD -- docker.rb $ cd - $ brew info docker # check the installed versions and current version ... /usr/local/Cellar/docker/1.1.1 (9 files, 9.8M) * Poured from bottle /usr/local/Cellar/docker/1.2.0 (9 files, 6.6M) Poured from bottle ... $ docker-tunnel user@example.com (user@example.com) $ docker version Client version: 1.0.0 Client API version: 1.12 ... (user@example.com) $ exit $ brew switch 1.2.0 # restore to latest
- bind: Address already in use. cannot listen to port: 4243
- 您可以找到用sudo lsof -i :4243保存4243端口的进程,并决定终止它或用--local-port选择另一个端口。
- channel 1: open failed: connect failed: Connection refused. 2014/09/06 13:08:57 Get http://127.0.0.1:4243/v1.14/info: EOF
- Docker服务器是否监听127.0.0.1:2375?您可能必须使用--remote-host和--remote-port设置正确的服务器信息。
已知错误
- ssh隧道只能使用公钥进行身份验证。密码提示将导致崩溃。
问题
如果要报告错误或请求功能,请在 GitHub Issues。