Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

keypair prevents creation of machine with same name as the one just removed #661

Closed
DanLipsitt opened this issue Feb 27, 2015 · 21 comments
Closed

Comments

@DanLipsitt
Copy link

If the create command fails (in this case because I forgot the vpc-id flag) and I remove the failed image, I can't create a new one with the same name because the keypair doesn't get deleted:

$ docker-machine rm -f demo
$ docker-machine create --driver=amazonec2 --amazonec2-vpc-id=vpc-foo demo
INFO[0000] Creating CA: /Users/dan/.docker/machine/certs/ca.pem 
INFO[0001] Creating client certificate: /Users/dan/.docker/machine/certs/cert.pem 
ERRO[0003] Error creating machine: There is already a keypair with the name demo.  Please either remove that keypair or use a different machine name.

It seems that rm -f should remove associated keypairs.

Related: #119.

@cboettig
Copy link

cboettig commented Apr 2, 2015

+1

it would also/meanwhile be useful for the error message to point to how to remove such a keypair -- I get this error even when docker-machine ls does not show any machines, and docker -h doesn't suggest any other way of removing this keypair record.

@dougborg
Copy link

I have run into this as well. Does anyone know where these keypairs are being created? I have looked around in the machine storage path and in my home directory and come up empty.

@dougborg
Copy link

Ok, so now I get it. This is the "Key Pair" in EC2, not anything stored locally. I was able to remove them in the EC2 management console and now all is well.

@jolestar
Copy link

+1 @dougborg

@raykrueger
Copy link

It would also be helpful to be able to pass --amazonec2-keypair-name=whatever to re-use existing keypairs.

@chiefy
Copy link

chiefy commented May 13, 2015

👍 just ran into this - working within a group - we have a keypair we're sharing.

@ruffsl
Copy link

ruffsl commented Jul 7, 2015

+1 I ran into this today too.

@saada
Copy link

saada commented Jul 18, 2015

👍

@therealbill
Copy link

+1 as well. In my case it is telling me this even though when doing an aws describe-key-pairs and looking in the AWS console the key pair doesn't even exist. Some more verbosity in debug mode would help here as well.

@eipplusone
Copy link

+1

@dustinblackman
Copy link
Contributor

+:1 for --amazonec2-keypair-name

@PurrBiscuit
Copy link

+1

@bobby
Copy link

bobby commented Jan 12, 2016

+1 for --amazonec2-keypair-name

@java4africa
Copy link

You can delete the keypair in the AWS console. "Network & Security" -> "Key Pairs" -> "Delete"

@baljanak
Copy link

baljanak commented Mar 3, 2016

+1 for keypair-name option

@igorescobar
Copy link

--amazonec2-keypair-name 👍

@vikstrous
Copy link
Contributor

I keep running into this issue as well. Our automated docker machine creation scripts often fail and leave behind existing key pairs and then cause even more failures which require manual intervention to fix.

vikstrous added a commit to vikstrous/machine that referenced this issue Jun 10, 2016
Signed-off-by: Viktor Stanchev <me@viktorstanchev.com>
nathanleclaire added a commit that referenced this issue Aug 1, 2016
add --amazonec2-keypair-name flag, fix #661
@alexanderkjeldaas
Copy link

alexanderkjeldaas commented Sep 8, 2016

This bug is not fully fixed. The unhelpful error message is still there.

It should read:

Use aws ec2 delete-key-pair --key-name {{.Host}} to delete.

matthid added a commit to matthid/ClusterManagement that referenced this issue Mar 5, 2017
@matt-byrne
Copy link

I've just seen this issue too, on 1.5.3. In my case, the console showed no key pair with the relevant name, and neither did aws ec2 describe-key-pairs. That said, aws ec2 delete-key-pair --key-name xyz DID work, despite them not being visible...

@m-dunbar
Copy link

m-dunbar commented May 4, 2017

Creating a keypair for every new instance is an ugly kludge, and it's what's causing the underlying problem. True use of an existing key pair without duplication is the real solution. When with that be implemented.

Simply saying 'delete the keypair manually from aws' may be a workaround, but it is NOT a solution. How is clustering supposed to work with that? That won't scale.

@vikstrous
Copy link
Contributor

@m-dunbar --amazonec2-keypair-name is what you are looking for.

tomeon pushed a commit to tomeon/machine that referenced this issue May 9, 2018
Add ntpd and crond that restarts it, which combats the boot2docker suspend issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests