Machine: docker-machine rm <host> for AWS

Created on 22 Jun 2017  路  7Comments  路  Source: docker/machine

docker-machine version 0.12.0, build 45c69ad

Then trying removing AWS hosts docker-machine fails
Error removing host "": unexpected EOF

(<host>) DBG | ---[ RESPONSE ]--------------------------------------
(<host>) DBG | HTTP/1.1 200 OK
(<host>) DBG | Transfer-Encoding: chunked
(<host>) DBG | Content-Type: text/xml;charset=UTF-8
(<host>) DBG | Date: Thu, 22 Jun 2017 11:52:45 GMT
(<host>) DBG | Server: AmazonEC2
(<host>) DBG | Vary: Accept-Encoding
(<host>) DBG |
(<host>) DBG | 251
(<host>) DBG | <?xml version="1.0" encoding="UTF-8"?>
(<host>) DBG | <TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2016-04-01/">
(<host>) DBG |     <requestId>...</requestId>
(<host>) DBG |     <instancesSet>
(<host>) DBG |         <item>
(<host>) DBG |             <instanceId>...</instanceId>
(<host>) DBG |             <currentState>
(<host>) DBG |                 <code>48</code>
(<host>) DBG |                 <name>terminated</name>
(<host>) DBG |             </currentState>
(<host>) DBG |             <previousState>
(<host>) DBG |                 <code>48</code>
(<host>) DBG |                 <name>terminated</name>
(<host>) DBG |             </previousState>
(<host>) DBG |         </item>
(<host>) DBG |     </instancesSet>
(<host>) DBG | </TerminateInstancesResponse>
(<host>) DBG | 0
(<host>) DBG |
(<host>) DBG |
(<host>) DBG | -----------------------------------------------------
(<host>) DBG | panic: runtime error: invalid memory address or nil pointer dereference
(<host>) DBG | [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x15535d8]

All 7 comments

Same issue in Docker Machine Version: 0.12.0-rc2, build 64fa459

First time trigger for host - same issue different xml response

(<host>) DBG | <?xml version="1.0" encoding="UTF-8"?>
(<host>) DBG | <TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2016-04-01/">
(<host>) DBG |     <requestId>...</requestId>
(<host>) DBG |     <instancesSet>
(<host>) DBG |         <item>
(<host>) DBG |             <instanceId>...</instanceId>
(<host>) DBG |             <currentState>
(<host>) DBG |                 <code>32</code>
(<host>) DBG |                 <name>shutting-down</name>
(<host>) DBG |             </currentState>
(<host>) DBG |             <previousState>
(<host>) DBG |                 <code>16</code>
(<host>) DBG |                 <name>running</name>
(<host>) DBG |             </previousState>
(<host>) DBG |         </item>
(<host>) DBG |     </instancesSet>
(<host>) DBG | </TerminateInstancesResponse>

I was looking into an error exactly like this as our Gitlab-CI setup was not cleaning up keys correctly. We're running: Docker Machine Version: 0.12.0, build 45c69ad.

Reproduce:

docker-machine create --driver amazonec2 --amazonec2-access-key "--SNIP--" --amazonec2-secret-key "--SNIP--" --amazonec2-region eu-west-1 aws01

docker-machine -D rm aws01

We get the null reference too, and I've tried to follow the code using the Debug output. I arrive at the following line, as I in debug can see the terminating instance: %s output. I believe the error is caused by err being Null. This is odd, since line no. 954 expects err to not being something, while the next if on line no. 960 checks if err != nil.

https://github.com/docker/machine/blob/1532bc1a4de1490bde88b6f9b1dd40a9f6dc2932/drivers/amazonec2/amazonec2.go#L954

The offending commit is 21 days old:
https://github.com/docker/machine/commit/29bb630baebe7d2d6eec40cb37f475ccd89f0b9e

It introduced the check on err, even though err can be null.

Just confirmed that 0.11.0, build 5b27455 does not exhibit this error.

Just confirmed, still present in 0.12.1, build c8b17e8

Fixed in 0.12.2 馃憤

Was this page helpful?
0 / 5 - 0 ratings