我正在尝试使用docker-machine创建一个ec2 spot实例。我试图调试我的命令,发现它在ssh失败了。 我使用ssh-keygen创建了我的密钥对,并且我已将密钥对上传到aws。 我可以使用putty连接到实例。请帮我解决这个错误!
此外,我正在从ec2实例运行docker-machine命令。
docker-machine version:
docker-machine version 0.13.0, build 9ba6da9
命令:
docker-machine --debug create --driver amazonec2 --amazonec2-access-key xxxxxxxxx --amazonec2-secret-key xxxxxxxxx --amazonec2-ssh-user ubuntu --amazonec2-region us-east-1 --amazonec2-instance-type t2.large --amazonec2-ami ami-xxxxx--amazonec2-vpc-id vpc-xxxxx--amazonec2-subnet-id subnet-xxxx--amazonec2-zone a --amazonec2-root-size 32 --amazonec2-keypair-name id_rsa --amazonec2-ssh-keypath $HOME/.ssh/id_rsa --amazonec2-request-spot-instance --amazonec2-security-group dev --amazonec2-private-address-only --amazonec2-spot-price x.xx dev4
错误:
Using SSH client type: external
Using SSH private key: /home/centos/.docker/machine/machines/dev4/id_rsa (-rw-------)
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none ubuntu@xx.xxx.x.xx -o IdentitiesOnly=yes -i /home/centos/.docker/machine/machines/dev4/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: exit status 255:
Error getting ssh command 'exit 0' : ssh command error:
command : exit 0
err : exit status 255
output :
docker-machine inspect dev4
{
"ConfigVersion": 3,
"Driver": {
"IPAddress": "xx.xxx.xx.xx",
"MachineName": "dev4",
"SSHUser": "ubuntu",
"SSHPort": 22,
"SSHKeyPath": "/home/centos/.docker/machine/machines/dev4/id_rsa",
"StorePath": "/home/centos/.docker/machine",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": "",
"Id": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"AccessKey": "xxxxxxxxxx",
"SecretKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"SessionToken": "",
"Region": "us-east-1",
"AMI": "ami-xxxx",
"SSHKeyID": 0,
"ExistingKey": true,
"KeyName": "id_rsa",
"InstanceId": "i-xxxxxxxxxxxxxxxxxxxx",
"InstanceType": "t2.large",
"PrivateIPAddress": "xx.xxx.xx.xx",
"SecurityGroupId": "",
"SecurityGroupIds": [
"sg-xxxxxx"
],
"SecurityGroupName": "",
"SecurityGroupNames": [
"dev"
],
"OpenPorts": null,
"Tags": "",
"ReservationId": "",
"DeviceName": "/dev/sda1",
"RootSize": 32,
"VolumeType": "gp2",
"IamInstanceProfile": "",
"VpcId": "vpc-xxxxxx",
"SubnetId": "subnet-xxxxx",
"Zone": "a",
"RequestSpotInstance": true,
"SpotPrice": "x.xx",
"BlockDurationMinutes": 0,
"PrivateIPOnly": true,
"UsePrivateIP": false,
"UseEbsOptimizedInstance": false,
"Monitoring": false,
"SSHPrivateKeyPath": "/home/centos/.ssh/id_rsa",
"RetryCount": 5,
"Endpoint": "",
"DisableSSL": false,
"UserDataFile": ""
},
"DriverName": "amazonec2",
"HostOptions": {
"Driver": "",
"Memory": 0,
"Disk": 0,
"EngineOptions": {
"ArbitraryFlags": [],
"Dns": null,
"GraphDir": "",
"Env": [],
"Ipv6": false,
"InsecureRegistry": [],
"Labels": [],
"LogLevel": "",
"StorageDriver": "",
"SelinuxEnabled": false,
"TlsVerify": true,
"RegistryMirror": [],
"InstallURL": "https://get.docker.com"
},
"SwarmOptions": {
"IsSwarm": false,
"Address": "",
"Discovery": "",
"Agent": false,
"Master": false,
"Host": "tcp://0.0.0.0:3376",
"Image": "swarm:latest",
"Strategy": "spread",
"Heartbeat": 0,
"Overcommit": 0,
"ArbitraryFlags": [],
"ArbitraryJoinFlags": [],
"Env": null,
"IsExperimental": false
},
"AuthOptions": {
"CertDir": "/home/centos/.docker/machine/certs",
"CaCertPath": "/home/centos/.docker/machine/certs/ca.pem",
"CaPrivateKeyPath": "/home/centos/.docker/machine/certs/ca-key.pem",
"CaCertRemotePath": "",
"ServerCertPath": "/home/centos/.docker/machine/machines/dev4/server.pem",
"ServerKeyPath": "/home/centos/.docker/machine/machines/dev4/server-key.pem",
"ClientKeyPath": "/home/centos/.docker/machine/certs/key.pem",
"ServerCertRemotePath": "",
"ServerKeyRemotePath": "",
"ClientCertPath": "/home/centos/.docker/machine/certs/cert.pem",
"ServerCertSANs": [],
"StorePath": "/home/centos/.docker/machine/machines/dev4"
}
},
"Name": "dev4"
}