kitchen-docker: SSH connection failed
I’m running into an issue where is appears test-kitchen isn’t waiting long enough to SSH when I’m using /sbin/init for my run_command. If I wait a couple of second, I can then ssh into the instance. Is this something that can be addressed by kitchen-docker or are there any workarounds I might employ?
I’m trying to solve the problem of runit not starting when the package has been installed. On Debian systems, which I’m testing on, it starts via the inittab and the runit cookbook handles this by issuing a telinit once the package is installed.
$ sudo kitchen converge
-----> Starting Kitchen (v1.2.1)
-----> Creating <default-debian-74>...
Step 0 : FROM dgivens/wheezy
---> f8c92d987c7a
Step 1 : ENV DEBIAN_FRONTEND noninteractive
---> Using cache
---> 47cd72727fd3
Step 2 : RUN dpkg-divert --local --rename --add /sbin/initctl
---> Using cache
---> 68a0adca627d
Step 3 : RUN ln -sf /bin/true /sbin/initctl
---> Using cache
---> 22aa8539b9a5
Step 4 : RUN apt-get update
---> Using cache
---> e7a978183de9
Step 5 : RUN apt-get install -y sudo openssh-server curl lsb-release
---> Using cache
---> c3c4b40c5f5f
Step 6 : RUN mkdir -p /var/run/sshd
---> Using cache
---> 44186f2bdfc1
Step 7 : RUN useradd -d /home/kitchen -m -s /bin/bash kitchen
---> Using cache
---> 7bd45f37b4a4
Step 8 : RUN echo kitchen:kitchen | chpasswd
---> Using cache
---> b20a2a304c97
Step 9 : RUN echo 'kitchen ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
---> Using cache
---> bec122d32801
Successfully built bec122d32801
e79dce6f1a2b245a4314ece432944f0e93f33783b6e75d76783cbed778b2b652
[{
"ID": "e79dce6f1a2b245a4314ece432944f0e93f33783b6e75d76783cbed778b2b652",
"Created": "2014-03-07T13:59:25.340911399Z",
"Path": "/sbin/init",
"Args": [],
"Config": {
"Hostname": "e79dce6f1a2b",
"Domainname": "",
"User": "",
"Memory": 0,
"MemorySwap": 0,
"CpuShares": 0,
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"PortSpecs": null,
"ExposedPorts": {
"22/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"HOME=/",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DEBIAN_FRONTEND=noninteractive"
],
"Cmd": [
"/sbin/init"
],
"Dns": null,
"Image": "bec122d32801",
"Volumes": null,
"VolumesFrom": "",
"WorkingDir": "",
"Entrypoint": null,
"NetworkDisabled": false,
"OnBuild": null
},
"State": {
"Running": true,
"Pid": 12513,
"ExitCode": 0,
"StartedAt": "2014-03-07T13:59:25.491002705Z",
"FinishedAt": "0001-01-01T00:00:00Z",
"Ghost": false
},
"Image": "bec122d328011c78d9fe642c0b8d858894c9a5271da51b465831a6e718c935a2",
"NetworkSettings": {
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"Gateway": "172.17.42.1",
"Bridge": "docker0",
"PortMapping": null,
"Ports": {
"22/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "49195"
}
]
}
},
"ResolvConfPath": "/etc/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/e79dce6f1a2b245a4314ece432944f0e93f33783b6e75d76783cbed778b2b652/hostname",
"HostsPath": "/var/lib/docker/containers/e79dce6f1a2b245a4314ece432944f0e93f33783b6e75d76783cbed778b2b652/hosts",
"Name": "/dreamy_davinci5",
"Driver": "aufs",
"Volumes": {},
"VolumesRW": {},
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LxcConf": [],
"Privileged": false,
"PortBindings": {
"22/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "49195"
}
]
},
"Links": null,
"PublishAllPorts": false
}
}]
Finished creating <default-debian-74> (0m0.55s).
-----> Converging <default-debian-74>...
Preparing files for transfer
Resolving cookbook dependencies with Berkshelf 2.0.14...
Removing non-cookbook files before transfer
Preparing data bags
Preparing environments
Preparing encrypted data bag secret
[SSH] connection failed, retrying (#<Net::SSH::Disconnect: connection closed by remote host>)
[SSH] connection failed, retrying (#<Net::SSH::Disconnect: connection closed by remote host>)
$$$$$$ [SSH] connection failed, terminating (#<Net::SSH::Disconnect: connection closed by remote host>)
>>>>>> Converge failed on instance <default-debian-74>.
>>>>>> Please see .kitchen/logs/default-debian-74.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: connection closed by remote host
>>>>>> ----------------------
daniel.givens@jenkins-n02:~/fusion$ ssh kitchen@localhost -p 49195
The authenticity of host '[localhost]:49195 ([127.0.0.1]:49195)' can't be established.
ECDSA key fingerprint is 84:80:c6:6b:86:bd:47:ed:35:53:0c:e2:99:07:bd:99.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:49195' (ECDSA) to the list of known hosts.
kitchen@localhost's password:
Linux e79dce6f1a2b 3.11.0-13-generic #20-Ubuntu SMP Wed Oct 23 07:38:26 UTC 2013 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
kitchen@e79dce6f1a2b:~$
About this issue
- Original URL
- State: open
- Created 10 years ago
- Comments: 16 (3 by maintainers)
+1