Waiting for SSH service on Test Kitchen with the Docker driver

Although the Docker driver is no longer included by default in the Chef Workstation, with kitchen-dokken being recommended now, you may still want to use it.

I was trying to run one of my older cookbooks, which uses it for integration tests, and found that my container was just timing out trying to connect:

Waiting for SSH service on localhost:49156, retrying in 3 seconds
Waiting for SSH service on localhost:49156, retrying in 3 seconds
Waiting for SSH service on localhost:49156, retrying in 3 seconds

This is odd, because I could see the container running, but nothing was happening with it, so there shouldn't have been a timeout.

When running Kitchen with debug logs, I could see Connection reset by peer, which was increasingly odd:

D, [2021-04-07T13:46:32.165084 #122004] DEBUG -- default-debian: [SSH] connection failed (#<Errno::ECONNRESET: Connection reset by peer>)
I, [2021-04-07T13:46:32.165222 #122004]  INFO -- default-debian: Waiting for SSH service on localhost:49156, retrying in 3 seconds

It turns out that I was missing the transport configuration in my kitchen.yml:

transport:
  name: docker

Once I'd added this, the connection worked straight away, and my tests ran successfully.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #chef #test-kitchen #docker.

This post was filed under articles.

Related Posts

Other posts you may be interested in:

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.