0

I am trying to use kitchen-docker driver on a GNU/Linux machine. I have installed the kitchen-docker gem using chef gem install command.

This is an extract of my .kitchen.yml file:

---
driver:
  name: docker

provisioner:
  name: chef_zero

verifier:
  name: inspec

platforms:
  - name: centos-7.2
    driver_config:
      image: centos:7.2
      platform: centos

suites:
  - name: zaz
    run_list:
      - recipe[foo::bar]
...
...

I have Docker installed on it's latest version using Docker repositories for Centos. The service is running and Docker is in my path. However when I try to run a simple kitchen list using that .kitchen.yml I get this error:

[FakeyMcFakeFace@workstation foo]$ kitchen list
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::UserError
>>>>>> Message: You must first install the Docker CLI tool http://www.docker.io/gettingstarted/
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

Why is docker not being recognized by Kitchen? If I run the diagnose -all option I just see it is failing on the dependencies check:

backtrace:
- "/home/FakeyMcFakeFace/.chefdk/gem/ruby/2.3.0/gems/kitchen-docker-2.6.0/lib/kitchen/driver/docker.rb:93:in
  `rescue in verify_dependencies'"

What am I missing here?

Navarro
  • 1,284
  • 2
  • 17
  • 40
  • Is your user allowed to access the docker socket? (Does `docker ps` work?). Or do you run it with `sudo docker ps`? In the first case, try to set `use_sudo: false`, as I would then assume that you don't have sudo installed and kitchen-docker assumes it's available. – StephenKing Mar 15 '17 at 12:52
  • Docker is run as root, so `sudo` is needed for all commands. The default `use_sudo: true` is good for me. Also I have the default socket location... it should be accessible naturally. – Navarro Mar 15 '17 at 13:47
  • Anything useful from `-l debug`? – StephenKing Mar 15 '17 at 13:58
  • Seems like kitchen-docker **requires** passwordless `sudo`... is this undocumented or I just misread something? – Navarro Mar 15 '17 at 15:15
  • How would it use anything other than passwordless sudo? – coderanger Mar 15 '17 at 17:48
  • 1
    Requesting password during kitchen run instead of failing or giving some useful data in the error message :-/ – Navarro Mar 15 '17 at 20:47
  • Unfortunately it's very tricky to pass an external password in to sudo so it's going to be a low priority thing. – coderanger Mar 16 '17 at 00:07
  • 1
    But yes, I do need to fix the diagnostics to better detect which part is failing – coderanger Mar 16 '17 at 00:07

1 Answers1

2

To copy down from the comments, kitchen-docker requires passwordless sudo (if using sudo) right now, the error message is misleading

coderanger
  • 52,400
  • 4
  • 52
  • 75