gpt4 book ai didi

amazon-web-services - "docker-machine rm"在不存在的 EC2 实例上失败

转载 作者:行者123 更新时间:2023-12-04 18:02:47 25 4
gpt4 key购买 nike

我使用 docker-machine 来管理 AWS 上的 Docker 节点。今天我尝试创建一个新节点,但由于实例类型和指定的 AMI 之间不兼容而失败:

docker-machine create --driver amazonec2 --amazonec2-instance-type t2.micro --amazonec2-ami ami-b4a015d4 certbot-config
Running pre-create checks...
Creating machine...
(certbot-config) Launching instance...
Error creating machine:
Error in driver during machine creation:
Error launching instance: InvalidParameterCombination: Virtualization type 'hvm' is required for instances of type 't2.micro'. Ensure that you are using an AMI with virtualization type 'hvm'. For more information, see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/virtualization_types.html

无论如何,我纠正错误。我的问题是我好像创造了一个幽灵机器;如果我运行 docker-machine ls,我会得到这个:
NAME             ACTIVE   DRIVER      STATE   URL   SWARM   DOCKER    ERRORS
certbot-config - amazonec2 Error Unknown MissingParameter: The request must contain the parameter InstanceId
status code: 400, request id:

我无法删除、杀死它、重新启动它或配置它;每个命令都会从 AWS 驱动程序退出,并显示 400 错误:
~$ docker-machine rm certbot-config
About to remove certbot-config
Are you sure? (y/n): y
Error removing host "certbot-config": unknown instance
MissingParameter: The request must contain the parameter KeyName
status code: 400, request id:

如何清除这个悬空实例?我有很多实例在 docker-machine 下运行,所以我不想做任何激烈的事情,比如重新安装。

编辑:

也许另一种框架是这样的:docker-machine 在哪里跟踪托管主机?据推测,我的计算机中某处有一个文件,其中包含一个主机列表,当我运行“docker-machine ls”时,它会在该列表中下降并 ping 状态。这个文件在哪里,我可以安全地删除我知道已经死了的主机而不会在其他地方留下垃圾吗?

最佳答案

Perhaps another way to frame this: where is docker-machine keeping track of managed hosts?



检查您是否有环境变量 MACHINE_STORAGE_PATH .

如果没有,那些 VMS 应该在 ~/.docker .

您还可以看到 Unresolved issue 3555 :

Using docker-machine to provision a spot instance opens a spot request and waits for it to be fulfilled. If this fails, docker-machine exits but the spot request remains open and may be fulfilled later. This results in a dangling spot request with an active instance.



docker-machine 讨论了 Spot 实例支持在 issue 226 .

From Spot Request, the main additional parameters seem to be Bid, Request valid From/To and Persistent request.



http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/spot_introduction.png

In the context of machine, I guess you could set request valid to = now + 2 minutes or so, at which point the command could fail.



添加支持的 PR 是 PR 942PR 1000 .
docker-machine rm 可能无法充分找到/提供 Spot 实例所需的额外参数。

除了从 ~/.docker/machine/machines 中删除相应目录外,您还需要从 AWS EC2 控制台中删除相应的 EC2 key 对。

关于amazon-web-services - "docker-machine rm"在不存在的 EC2 实例上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41291115/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com