更改docker-machine的DigitalOcean访问令牌

时间:2015-07-30 08:24:49

标签: docker digital-ocean docker-machine

我使用DigitalOcean驱动程序创建了一个主机。但是,我必须生成一个新的访问令牌,现在无法连接到它。如何重新配置​​docker-machine以使用新的访问令牌?

1 个答案:

答案 0 :(得分:3)

每个使用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": ""
}