kitchen-docker
kitchen-docker copied to clipboard
Waiting for SSH service on localhost:49714, retrying in 3 seconds
:ghost: Brief Description
When I run the kitchen-docker on Ubuntu 2204 I get stuck in this permanent loop where it cannot connect to the container through SSH. Worth noting that this worked just fine on Ubuntu 1804
Waiting for SSH service on localhost:49714, retrying in 3 seconds
Waiting for SSH service on localhost:49714, retrying in 3 seconds
Waiting for SSH service on localhost:49714, retrying in 3 seconds
Waiting for SSH service on localhost:49714, retrying in 3 seconds
Waiting for SSH service on localhost:49714, retrying in 3 seconds
Version
kitchen-docker (2.13.0)
➜ kitchen --version
Test Kitchen version 3.3.2
Environment
OS: macOS 13.1
.kitchen.yml
---
driver:
name: docker
transport:
max_ssh_sessions: 6
provisioner:
name: ansible_playbook
hosts: localhost
roles_path: ./
require_ansible_repo: true
ansible_verbose: true
idempotency_test: true
platforms:
- name: ubuntu-22.04
driver_config:
image: ubuntu:22.04
privileged: true
provision_command:
- apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:ansible/ansible
- apt-get update && apt-get -y -q install ansible python3-apt python3-pycurl
- mkdir -p /run/sshd
use_sudo: false
suites:
- name: standard
provisioner:
playbook: test/integration/standard.yml
additional_copy_path:
- "."
run_list:
attributes:
Scenario
I want to test my ansible playbook on a ubuntu 22.04 image
Steps to Reproduce
clone https://github.com/Terkea/ansible-beats git checkout ubuntu22_support make converge
Expected Result
Run the ansible playbook on the docker container
Actual Result
You should get stuck in that infinite loop where it cannot SSH
:heavy_plus_sign: Additional context
I have seen this was an issue a few years ago, but I haven't managed to identify how people fixed it
➜ ansible-beats git:(ubuntu22_support) ✗ bundle exec kitchen converge -l debug
-----> Starting Test Kitchen (v3.3.2)
D [local command] BEGIN (docker >> /dev/null 2>&1)
D [local command] END (0m0.17s)
-----> Creating <standard-ubuntu-2204>...
D docker_command: docker -H unix:///var/run/docker.sock top e568226dd186403de40579b0febb1afe92a1223fb86ac67b6bc288990947a4cc shell_opts: {}
D [local command] BEGIN (docker -H unix:///var/run/docker.sock top e568226dd186403de40579b0febb1afe92a1223fb86ac67b6bc288990947a4cc)
UID PID PPID C STIME TTY TIME CMD
root 21460 21439 0 10:57 ? 00:00:00 sshd: /usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no -o PasswordAuthentication=yes -o UsePrivilegeSeparation=no -o PidFile=/tmp/sshd.pid [listener] 0 of 10-100 startups
D [local command] END (0m0.10s)
Container ID e568226dd186403de40579b0febb1afe92a1223fb86ac67b6bc288990947a4cc already exists.
D Creating Linux container
D docker_command: docker -H unix:///var/run/docker.sock port e568226dd186403de40579b0febb1afe92a1223fb86ac67b6bc288990947a4cc 22/tcp shell_opts: {}
D [local command] BEGIN (docker -H unix:///var/run/docker.sock port e568226dd186403de40579b0febb1afe92a1223fb86ac67b6bc288990947a4cc 22/tcp)
0.0.0.0:50695
D [local command] END (0m0.12s)
D [SSH] opening connection to kitchen@localhost<{:user_known_hosts_file=>"/dev/null", :port=>50695, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :keepalive_maxcount=>3, :timeout=>15, :keys_only=>true, :keys=>["/Users/marian/code/ansible-beats/.kitchen/docker_id_rsa"], :auth_methods=>["publickey"], :verify_host_key=>:never}>
D [SSH] connection failed (#<Net::SSH::AuthenticationFailed: Authentication failed for user kitchen@localhost>)
Waiting for SSH service on localhost:50695, retrying in 3 seconds
D [SSH] opening connection to kitchen@localhost<{:user_known_hosts_file=>"/dev/null", :port=>50695, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :keepalive_maxcount=>3, :timeout=>15, :keys_only=>true, :keys=>["/Users/marian/code/ansible-beats/.kitchen/docker_id_rsa"], :auth_methods=>["publickey"], :verify_host_key=>:never, :logger=>#<Logger:0x00007fb41f8a5a68 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007fb41f8a5680 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007fb41f8a5180 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Thread::Mutex:0x00007fb41f8a4fc8>, @mon_mutex_owner_object_id=70205799999680, @mon_owner=nil, @mon_count=0>>, :password_prompt=>#<Net::SSH::Prompt:0x00007fb41f8a4ed8>, :user=>"kitchen"}>
D [SSH] connection failed (#<Net::SSH::AuthenticationFailed: Authentication failed for user kitchen@localhost>)
Waiting for SSH service on localhost:50695, retrying in 3 seconds
D [SSH] opening connection to kitchen@localhost<{:user_known_hosts_file=>"/dev/null", :port=>50695, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :keepalive_maxcount=>3, :timeout=>15, :keys_only=>true, :keys=>["/Users/marian/code/ansible-beats/.kitchen/docker_id_rsa"], :auth_methods=>["publickey"], :verify_host_key=>:never, :logger=>#<Logger:0x00007fb41f8a5a68 @level=4, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007fb41f8a5680 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007fb41f8a5180 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Thread::Mutex:0x00007fb41f8a4fc8>, @mon_mutex_owner_object_id=70205799999680, @mon_owner=nil, @mon_count=0>>, :password_prompt=>#<Net::SSH::Prompt:0x00007fb41f8a4ed8>, :user=>"kitchen"}>
If it helps, I had the same issue and managed to solve it simply by adding :
transport:
name: docker