Skip to content

feat: Implement kitchen login for docker transport - #422

Open
RulerOf wants to merge 1 commit into
test-kitchen:mainfrom
RulerOf:kitchen-login-support
Open

feat: Implement kitchen login for docker transport#422
RulerOf wants to merge 1 commit into
test-kitchen:mainfrom
RulerOf:kitchen-login-support

Conversation

@RulerOf

@RulerOf RulerOf commented Jul 31, 2024

Copy link
Copy Markdown
Contributor

Description

Implements kitchen login when using the docker transport.

Issues Resolved

Might not be any, although I briefly mentioned it in #387

Type of Change

_feat_

Check List

Signed-off-by: Andrew Bobulsky <rulerof@gmail.com>
@damacus damacus mentioned this pull request Mar 17, 2025
3 tasks

@damacus damacus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to pull this in but where does it get used?

@RulerOf

RulerOf commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

...wowza github notifications are the worst 😅

So if you want to converge a container without relying on having to install and configure openssh inside of the container for transport, you'd use the docker transport:

transport:
  name: docker

This works great for transferring files and such, but without the patch, you lose a critical debugging feature, as kitchen login does not work—I'm unaware of whether or not this has changed since, but I assume it still doesn't.

If you'd like a ready-to-go example, you could try one of my cookbooks that uses my fork.

╭─ ~/Projects/buyerquest/chef_repo/cookbooks/chef-td-agent master *2
╰─❯ yq .transport kitchen.yml
name: docker
╭─ ~/Projects/buyerquest/chef_repo/cookbooks/chef-td-agent master *2
╰─❯ bundle exec kitchen create v5-cinc18-amazonlinux-2023 > /dev/null
╭─ ~/Projects/buyerquest/chef_repo/cookbooks/chef-td-agent master *2
╰─❯ bundle exec kitchen login -l debug v5-cinc18-amazonlinux-2023
D      [local command] BEGIN (docker >> /dev/null 2>&1)
D      [local command] END (0m0.21s)
<snip>lots of Policyfile spam</snip>

D      docker_command: docker -H unix:///var/run/docker.sock
D      build_exec_command: exec -t -i 7e1db702aa9fe610d4127f0eb026389aae86cfe203899d80cfcd72c102dd78ca /bin/bash -login -i
D      Login command: docker -H unix:///var/run/docker.sock exec -t -i 7e1db702aa9fe610d4127f0eb026389aae86cfe203899d80cfcd72c102dd78ca /bin/bash -login -i (Options: {})
[root@7e1db702aa9f /]# whoami
root
[root@7e1db702aa9f /]#
logout

What's next:
    Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug 7e1db702aa9fe610d4127f0eb026389aae86cfe203899d80cfcd72c102dd78ca
    Learn more at https://docs.docker.com/go/debug-cli/

To be candid, I think docker transport is both the crown jewel and missing piece of this driver. The built-in list of container mods that installs/configures openssh and such for various distro containers is really hacky and unreliable with improperly-detected distros or unsupported ones. I may be misdirecting some frustrations I've had with trying to use openssh in containers with systemd under platform emulation, but the requirement to keep SSH working in the container means that ssh-configuring chef code can break ssh-based transports.... you probably get the idea 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants