I am trying to test a simple cookbook recipe using docker driver. But, I get an error.
Can someone please help? I really gave my all effort trying several things but none of them worked. I had installed docker kitchen driver also using command: chef gem install kitchen-docker
. Below are my configurational files, chef versions, kitchen.yml file etc.
Chef version
Chef Workstation version: 22.6.973
Chef InSpec version: 4.56.20
Chef CLI version: 5.6.1
Chef Habitat version: 1.6.420
Test Kitchen version: 3.2.2
Cookstyle version: 7.32.1
Chef Infra Client version: 17.10.0
chef gem list kitchen-docker
gives output as: kitchen-docker (2.13.0)
Below is my kitchen.yml
file
---
driver:
name: docker
provision_command: curl -L https://www.chef.io/chef/install.sh | bash
provisioner:
name: chef_zero
## product_name and product_version specifies a specific Chef product and version to install.
## see the Chef documentation for more details: https://docs.chef.io/workstation/config_yml_kitchen/
# product_name: chef
# product_version: 17
verifier:
name: inspec
platforms:
- name: ubuntu
- name: centos-7
driver_config:
image: 'centos:7'
platform: centos
transport:
name: docker
suites:
- name: default
run_list:
- recipe[docker-cookbook::default]
verifier:
inspec_tests:
- test/integration/default
attributes:
My recipe: default.rb
#
# Cookbook:: docker-cookbook
# Recipe:: default
#
# Copyright:: 2022, The Authors, All Rights Reserved.
file '/tmp/test.txt' do
content 'This is managed by Rapidops'
action :create
end
But, when I do kitchen list
, I am getting below error:
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::UserError
>>>>>> Message: Kitchen YAML file /root/chef-repo/cookbooks/docker-cookbook/recipes/kitchen.yml does not exist.
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration