chef-boneyard / chef-provisioning-docker

Docker provisioner for chef-provisioning
Apache License 2.0
92 stars 41 forks source link

Cannot Run Samples w/ boot2docker #18

Open herriojr opened 9 years ago

herriojr commented 9 years ago

I installed boot2docker (1.3.1) and installed docker (1.3.1) my my OS X 10.10 system. I set up boot2docker by:

$ boot2docker init
$ boot2docker up
$ export DOCKER_HOST=tcp://192.168.59.103:2376
$ export DOCKER_CERT_PATH=/Users/jherriott/.boot2docker/certs/boot2docker-vm
$ export DOCKER_TLS_VERIFY=1
$ export CHEF_DRIVER=docker

From the OS X command prompt, I am unable to run:

$ bundle exec chef-client -z docker_ubuntu_image.rb
/Users/jherriott/.rvm/gems/ruby-2.1.2/gems/bundler-1.6.5/lib/bundler/rubygems_integration.rb:256:in `block in replace_gem': chef is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
    from /Users/jherriott/.rvm/gems/ruby-2.1.2/bin/chef-client:22:in `<main>'
    from /Users/jherriott/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
    from /Users/jherriott/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'

however, I can get it partially going doing:

$ chef-client -z docker_ubuntu_image.rb
[2014-11-07T17:02:21-08:00] WARN: No config file found or specified on command line, using command line options.
[2014-11-07T17:02:21-08:00] WARN: No cookbooks directory found at or above current directory.  Assuming /Users/jherriott/workspace/chef-provisioning/docs/examples.
Starting Chef Client, version 11.16.4
resolving cookbooks for run list: []
Synchronizing Cookbooks:
Compiling Cookbooks...
WARN: Unresolved specs during Gem::Specification.reset:
      mini_portile (~> 0.6.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
[2014-11-07T17:02:35-08:00] WARN: Node Bitcasas-MacBook-Pro.local has an empty run list.
Converging 2 resources
Recipe: @recipe_files::/Users/jherriott/workspace/chef-provisioning/docs/examples/docker_ubuntu_image.rb
  * machine_image[web_server] action create
    - update node web_server at http://localhost:8889
    -   update normal.chef_provisioning.location.allocated_at from "2014-11-08 00:53:12 UTC" to "2014-11-08 01:02:35 UTC"
    ================================================================================
    Error executing action `create` on resource 'machine_image[web_server]'
    ================================================================================

    Excon::Errors::SocketError
    --------------------------
    No such file or directory - connect(2) for /var/run/docker.sock (Errno::ENOENT)

    Resource Declaration:
    ---------------------
    # In /Users/jherriott/workspace/chef-provisioning/docs/examples/docker_ubuntu_image.rb

      3: machine_image 'web_server' do
      4:   recipe 'apache'
      5: 
      6:   machine_options :docker_options => {
      7:       :base_image => {
      8:           :name => 'ubuntu',
      9:           :repository => 'ubuntu',
     10:           :tag => '14.04'
     11:       }
     12:   }
     13: end
     14: 

    Compiled Resource:
    ------------------
    # Declared in /Users/jherriott/workspace/chef-provisioning/docs/examples/docker_ubuntu_image.rb:3:in `from_file'

    machine_image("web_server") do
      action :create
      retries 0
      retry_delay 2
      guard_interpreter :default
      chef_server {:chef_server_url=>"http://localhost:8889", :options=>{:client_name=>"Bitcasas-MacBook-Pro.local", :signing_key_filename=>nil}}
      driver "docker"
      machine_options {:docker_options=>{:base_image=>{:name=>"ubuntu", :repository=>"ubuntu", :tag=>"14.04"}}}
      cookbook_name "@recipe_files"
      recipe_name "/Users/jherriott/workspace/chef-provisioning/docs/examples/docker_ubuntu_image.rb"
      run_list_modifiers [#<Chef::RunList::RunListItem:0x007fce63cd44f0 @version=nil, @type=:recipe, @name="apache">]
    end

Running handlers:
[2014-11-07T17:02:35-08:00] ERROR: Running exception handlers
Running handlers complete
[2014-11-07T17:02:35-08:00] ERROR: Exception handlers complete
[2014-11-07T17:02:35-08:00] FATAL: Stacktrace dumped to /Users/jherriott/.chef/local-mode-cache/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 9.849394 seconds
[2014-11-07T17:02:35-08:00] ERROR: machine_image[web_server] (@recipe_files::/Users/jherriott/workspace/chef-provisioning/docs/examples/docker_ubuntu_image.rb line 3) had an error: Excon::Errors::SocketError: No such file or directory - connect(2) for /var/run/docker.sock (Errno::ENOENT)
[2014-11-07T17:02:35-08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

So, my question is, what am I doing wrong? Is there something I need to fix?

marc- commented 9 years ago

Make sure docker service is running. From error above seems it is not.

jkeiser commented 9 years ago

Suspect no repro. @marc-, are you running the provisioner via boot2docker on OS X perchance?

marc- commented 9 years ago

No, I run it on linux. But got similiar error, when docker service was stopped:

   Excon::Errors::SocketError
    --------------------------
    No such file or directory - connect(2) (Errno::ENOENT)