我在Azure上有一个基于Docker的部署。我知道docker-machine有一个Azure驱动程序,它可以创建虚拟机并生成证书等。但我宁愿使用Azure工具(CLI和门户网站)。
所以我创建了一个VM,并在其上安装了我的公共SSH密钥。现在我想使用docker-machine连接到它。我添加了服务器,以便在我docker-machine ls
时能看到它:
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Stopped Unknown
serv - generic Running tcp://XX.XX.XX.XX:2376 Unknown Unable to query docker version: Unable to read TLS config: open /Users/user/.docker/machine/machines/serv/server.pem: no such file or directory
当我尝试设置环境变量时,我看到了:
$ docker-machine env serv
Error checking TLS connection: Error checking and/or regenerating the certs:
There was an error validating certificates for host "XX.XX.XX.XX:2376":
open /Users/user/.docker/machine/machines/serv/server.pem: no such file or directory
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.
当我尝试重新生成证书时,我得到:
$ docker-machine regenerate-certs serv
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Something went wrong running an SSH command!
command : sudo hostname serv && echo "serv" | sudo tee /etc/hostname
err : exit status 1
output : sudo: no tty present and no askpass program specified
我可以SSH到服务器。
这里有什么问题?我怎样才能使它发挥作用?