更改 docker-机器的 DigitalOcean 访问令牌
Change DigitalOcean access token for docker-machine
我使用 DigitalOcean 驱动程序创建了一个主机。但是,我必须生成一个新的访问令牌,现在无法连接到它。如何重新配置 docker-machine 以使用新的访问令牌?
每个使用 docker-machine
启动的主机都会在 ~/.docker/machine/machines/
下创建一个文件夹来保存其配置。DigitalOcean 访问令牌和有关 Droplet 的其他信息存储在 config.json
文件中。我们看一个具体的例子:
$ cat ~/.docker/machine/machines/docker-001/config.json | jq .
{
"DriverName": "digitalocean",
"Driver": {
"AccessToken": "9dasd89ssf6542notarealtoken455b44sdgf4685",
"DropletID": 4906043,
"DropletName": "",
"Image": "ubuntu-14-04-x64",
"MachineName": "docker-001",
"IPAddress": "45.32.128.70",
"Region": "nyc3",
"SSHKeyID": 7697371,
"Size": "512mb",
"CaCertPath": "/home/asb/.docker/machine/certs/ca.pem",
"PrivateKeyPath": "/home/asb/.docker/machine/certs/ca-key.pem",
"DriverKeyPath": "",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": ""
},
"CaCertPath": "/home/asb/.docker/machine/certs/ca.pem",
"ServerCertPath": "",
"ServerKeyPath": "",
"PrivateKeyPath": "/home/asb/.docker/machine/certs/ca-key.pem",
"ClientCertPath": "",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": ""
}
我使用 DigitalOcean 驱动程序创建了一个主机。但是,我必须生成一个新的访问令牌,现在无法连接到它。如何重新配置 docker-machine 以使用新的访问令牌?
每个使用 docker-machine
启动的主机都会在 ~/.docker/machine/machines/
下创建一个文件夹来保存其配置。DigitalOcean 访问令牌和有关 Droplet 的其他信息存储在 config.json
文件中。我们看一个具体的例子:
$ cat ~/.docker/machine/machines/docker-001/config.json | jq .
{
"DriverName": "digitalocean",
"Driver": {
"AccessToken": "9dasd89ssf6542notarealtoken455b44sdgf4685",
"DropletID": 4906043,
"DropletName": "",
"Image": "ubuntu-14-04-x64",
"MachineName": "docker-001",
"IPAddress": "45.32.128.70",
"Region": "nyc3",
"SSHKeyID": 7697371,
"Size": "512mb",
"CaCertPath": "/home/asb/.docker/machine/certs/ca.pem",
"PrivateKeyPath": "/home/asb/.docker/machine/certs/ca-key.pem",
"DriverKeyPath": "",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": ""
},
"CaCertPath": "/home/asb/.docker/machine/certs/ca.pem",
"ServerCertPath": "",
"ServerKeyPath": "",
"PrivateKeyPath": "/home/asb/.docker/machine/certs/ca-key.pem",
"ClientCertPath": "",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": ""
}