kitchen-docker: Can't run kitchen-docker with Docker for Mac

I have the new Docker for Mac installed and I can run docker just fine. When I run kitchen docker though I get the following error:

)-> kitchen converge --log-level=debug
-----> Starting Kitchen (v1.7.3)
D      [kitchen::driver::docker command] BEGIN (sudo -E docker >> /dev/null 2>&1)
D      [kitchen::driver::docker command] END (0m0.01s)
>>>>>> ------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

D      ------Exception-------
D      Class: Kitchen::UserError
D      Message: You must first install the Docker CLI tool http://www.docker.io/gettingstarted/
D      ---Nested Exception---
D      Class: Kitchen::ShellOut::ShellCommandFailed
D      Message: Expected process to exit with [0], but received '1'
---- Begin output of sudo -E docker >> /dev/null 2>&1 ----
STDOUT:
STDERR:
---- End output of sudo -E docker >> /dev/null 2>&1 ----
Ran sudo -E docker >> /dev/null 2>&1 returned 1
D      ------Backtrace-------
D      /Users/thiagoo/.chefdk/gem/ruby/2.1.0/gems/kitchen-docker-2.4.0/lib/kitchen/driver/docker.rb:78:in `rescue in verify_dependencies'
D      /Users/thiagoo/.chefdk/gem/ruby/2.1.0/gems/kitchen-docker-2.4.0/lib/kitchen/driver/docker.rb:76:in `verify_dependencies'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/driver.rb:45:in `for_plugin'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/config.rb:230:in `new_driver'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/config.rb:243:in `new_instance'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/config.rb:139:in `block in build_instances'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/config.rb:138:in `map'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/config.rb:138:in `with_index'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/config.rb:138:in `build_instances'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/config.rb:114:in `instances'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/command.rb:115:in `filtered_instances'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/command.rb:145:in `parse_subcommand'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/command/action.rb:38:in `block in call'
D      /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/command/action.rb:37:in `call'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/cli.rb:56:in `perform'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/cli.rb:180:in `block (2 levels) in <class:CLI>'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/cli.rb:321:in `invoke_task'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/bin/kitchen:13:in `block in <top (required)>'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/lib/kitchen/errors.rb:154:in `with_friendly_errors'
D      /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.7.3/bin/kitchen:13:in `<top (required)>'
D      /opt/chefdk/bin/kitchen:17:in `load'
D      /opt/chefdk/bin/kitchen:17:in `<main>'
D      ----------------------

)-> sudo -E docker >> /dev/null 2>&1

)-> echo $?
0

)->

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 2
  • Comments: 27 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I tried the use_sudo: false workaround from #201 and it works. 😄 … But it’s just a workaround. It should work whether or not I use sudo.

So the work around steps are:

  • active port-forwarding
    pinata set network nat external-bind=true
  • add use_sudo: false to your kitchen.yml driver config:
    driver:
      name: docker
      use_sudo: false

Just run eval (docker-machine env default) on the shell. This is an issue with the Mac, not the driver. If you can’t docker ps then the driver doesn’t stand a chance

On OSX, I was able to get around this error permanently by:

  1. Clicking Docker Icon on the menu bar
  2. Clicking preferences
  3. Clicking “Reset”
  4. Clicking “Remove all data”
  5. Clicking “Reset to factory defaults”

I haven’t seen it since.

Not everyone can do this, because it’s highly destructive operation, but I suspect most can because they are using Docker purely for dev purposes on their workstation.

Ran into this issue today:

OSX 10.11.6 Docker version 1.12.1, build 6f9534c kitchen-docker 2.6.0

Had to add use_sudo: false to .kitchen.yml to get it to work.

@davidcpell You can also add use_sudo: false to your ~/.kitchen/config.yml in the driver section.

This solution was mentioned on the PR referenced above, but never brought back here.

i don’t use docker-machine, though… i’m using the native docker for mac. no docker environment variables need to be set for it.

Is there anything I could do to help address this issue?

Or perhaps there is a different recommendation for using Test Kitchen with Docker on a Mac?

I’m blocked right now and I’m not sure how to proceed.

If I use this use_sudo: false work-around, I can make the Class: Kitchen::UserError Message: You must first install the Docker CLI tool... error go away, however, instead I get a failure like this on kitchen converge:

            Installing chef 12.14.89
                 installing with dpkg...
                 Selecting previously unselected package chef.
          (Reading database ... 16043 files and directories currently installed.)
                 Preparing to unpack .../chef_12.14.89-1_amd64.deb ...
                 Unpacking chef (12.14.89-1) ...
                 Setting up chef (12.14.89-1) ...
                 Thank you for installing Chef!
                 mkdir: cannot create directory ‘/tmp/kitchen’: No space left on device

which makes sense. When you run kitchen login default as the kitchen user (not root) and run mkdir /tmp/kitchen you get this same error, it’s because the provisioner now no longer has privileges to do this.

How do I give the provisioner the permissions it needs when use_sudo: false?

My .kitchen.yml

---
driver:
  name: docker
  use_sudo: false
  privileged: true
transport:
  max_ssh_sessions: 6
provisioner:
  name: chef_zero
  require_chef_omnibus: 12.21.4
  log_level: info
  data_bags_path: test/data_bags
  encrypted_data_bag_secret_key_path: test/data_bags/encrypted_data_bag_secret
verifier:
  name: inspec
  format: documentation
platforms:
  # We run this special image so we can keep upstart running
  # inside the container because
  # - runit services inside the container require it
  # - Gets around SSH connect issue: https://github.com/test-kitchen/kitchen-docker/issues/254
  # - runit cookbook recommends it: https://github.com/chef-cookbooks/runit#development
  - name: ubuntu-14.04
    driver_config:
      image: ubuntu-upstart:14.04
      platform: ubuntu
      disable_upstart: false
      run_command: /sbin/init

suites:
  - name: default
    named_run_list: default
    verifier:
      inspec_tests:
        - path: test/smoke/default
        - name: particle-inspec-foo-service
          git: git@github.com:spark/particle-inspec.git
    attributes:
      particle_foo_service:
        my_attribute: "foo"
      tags:
      - my_special_tag