如何更改Azure Docker VM的泊坞窗证书?

我已经使用azure vm docker create ...命令来创build一个azure docker vm,并且我想用ca.pemreplace默认的ca.pemserver-cert.pemserver-key.pem自行生成的证书。

但是我发现在重新启动azure虚拟机之后,自行生成的证书会被原来的证书replace。

有没有办法改变证书?

天青门户网站提供的一个快速解决scheme(但不是很漂亮):

  1. 再添加一个Docker扩展到您的虚拟机,并指定要使用的新证书。
  2. validation

=>扩展程序正确更新,但会在扩展名上显示错误

  1. 重新启动虚拟机

=>它应该工作正常

您可以在使用参数-C或其等价物创build虚拟机时提供所需的证书–docker-cert-dir

 azure vm docker create -h help: Create a VM help: help: Usage: vm docker create [options] <dns-name> <image> <user-name> [password] help: help: Options: help: -h, --help output usage information help: -v, --verbose use verbose output help: --json use json output help: -p, --docker-port [port] Port to use for docker [4243] help: -C, --docker-cert-dir [dir] Directory containing docker certs [~/.docker/] help: -c, --connect connect to existing VMs help: -l, --location <name> the location help: -a, --affinity-group <name> the affinity group help: -u, --blob-url <url> the blob url for OS disk help: -z, --vm-size <size> the virtual machine size [small] help: -n, --vm-name <name> the virtual machine name help: -e, --ssh [port] the ssh port to enable [22] help: -t, --ssh-cert <pem-file|fingerprint> the SSH certificate help: -P, --no-ssh-password indicates that the password should be removed when using --ssh-cert help: -w, --virtual-network-name <name> the virtual network name help: -b, --subnet-names <list> the comma-delimited subnet names help: -S, --static-ip <ip-address> the static IP address assigned to the virtual machine help: -R, --reserved-ip <name> the name of the reserved IP address assigned to the virtual machine help: -A, --availability-set <name> the name of availability set to create or use help: -s, --subscription <id> the subscription id help: -d, --custom-data <custom-data-file> CustomData file 

这是一个azure色docker扩展bug。

https://github.com/Azure/azure-docker-extension/issues/4

因为azure-docker-extension enable步骤总是复制证书而不是仅启动docker。