chef-infraberkshelf

How to include docker cookbook in chef?


I'm trying to define a chef recipe to install docker using the cookbook provided at this link: https://supermarket.chef.io/cookbooks/docker#readme

I'm using Berkshelf so I put this line on Berkfile

cookbook 'docker', '~> 2.9.6'

and this on the metadata.db

depends "docker"

My recipe is the following

include_recipe 'docker::docker_service'
include_recipe 'docker::docker_image'
include_recipe 'docker::docker_container'

docker_service 'default' do
        action [:create, :start]
end

but when I try to run the kitchen I obtain the following error:

ERROR: could not find recipe docker_service for cookbook docker

but if I look in my berkshelf repository the recipe is there:

$ ls ~/.berkshelf/cookbooks/docker-2.9.6/libraries/ | grep docker_service.rb
docker_service.rb

What am I doing wrong?

Thanks, Michele.


Solution

  • The docker cookbook does not provide any recipes, which is why your include_recipe calls fail.

    Instead, you just use the resources, like you already have with the docker_service resource.

    Your recipe should run when you delete your three include_recipe lines.