简体   繁体   English

更改docker-machine的URL

[英]Change the URL of a docker-machine

I created a machine via docker-machine create -d azure --azure-static-public-IP . 我通过docker-machine create -d azure --azure-static-public-IP创建了一台docker-machine create -d azure --azure-static-public-IP But what I did is I intentionally changed the public IP address of that VM. 但是我所做的是我有意更改了该VM的公共IP地址。 With this move, I can not docker-machine ssh or any docker-machine related command. 通过此举,我无法使用docker-machine ssh或任何与docker-machine相关的命令。 Seems like it's still sending request to the previous public-IP. 似乎它仍在向先前的公共IP发送请求。 How can I change that IP and convert it to the new one? 如何更改该IP并将其转换为新IP? I tried docker-machine regenerate-certs and even changing the config.json but nothing going to be happened… 我尝试了docker-machine regenerate-certs ,甚至更改了config.json,但是什么也没发生……

The only way I saw fixing this is to reverting back the previous public IP of that VM 我看到解决此问题的唯一方法是还原该VM的先前公共IP

You should be fine with a change of the IP in "config.json". 更改“ config.json”中的IP应该没问题。 For Example, if i have to change my IP on my default docker-machine, i would go here: 例如,如果我必须在默认的docker-machine上更改我的IP,我会在这里:

/Users/arne/.docker/machine/machines/default/config.json

Adjust the IP and run 调整IP并运行

docker-machine regenerate-certs myVM

This should work. 这应该工作。

Do you mean when you run Docker-machine ssh got this error: 您是说在运行Docker-machine ssh遇到此错误:

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "13.91.60.237:2376": x509: certificate is valid for 40.112.218.127, not 13.91.60.237 You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'. 错误检查TLS连接:错误检查和/或重新生成证书:验证主机“ 13.91.60.237:2376”的证书时出错:x509:证书对40.112.218.127有效,对13.91.60.237有效,您可以尝试重新生成它们使用'docker-machine regenerate-certs [name]'。 Be advised that this will trigger a Docker daemon restart which might stop running containers. 请注意,这将触发Docker守护程序重启,这可能会停止运行容器。

In my test lab, my first IP address is 40.112.218.127 , then I change it to 13.91.60.237 , get this error. 在测试实验室中,我的第一个IP地址是40.112.218.127 ,然后将其更改为13.91.60.237 ,收到此错误。

Then I use this command to regenerate it: docker-machine regenerate-certs jasonvmm , like this: 然后,我使用此命令来重新生成它: docker-machine regenerate-certs jasonvmm ,如下所示:

[root@jasoncli@jasonye jasonvmm]# docker-machine regenerate-certs jasonvmm
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
[root@jasoncli@jasonye jasonvmm]# docker-machine ssh jasonvmm
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-47-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

208 packages can be updated.
109 updates are security updates.


Last login: Fri Dec  8 06:22:09 2017 from 167.220.255.48

Also, we can use this command to check the new settings: docker-machine env jasonvmm 另外,我们可以使用此命令检查新设置: docker-machine env jasonvmm

[root@jasoncli@jasonye jasonvmm]# docker-machine env jasonvmm
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://13.91.60.237:2376"
export DOCKER_CERT_PATH="/root/.docker/machine/machines/jasonvmm"
export DOCKER_MACHINE_NAME="jasonvmm"
# Run this command to configure your shell: 
# eval $(docker-machine env jasonvmm)

Please use this script to regenerate them docker-machine regenerate-certs VMname . 请使用此脚本重新生成它们docker-machine regenerate-certs VMname

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM