2016-10-25 3 views
0

私はopsworkでドッカーを展開しようとしていますが、セットアップが失敗します。ログは下にコピーされます。AWS opswork docker:Cookbookがありません:そのような料理本:いいえdoocker

+================================================================================+ 
+Error Resolving Cookbooks for Run List:+ 
+================================================================================+ 

+Missing Cookbooks:+ 
+------------------+ 
+No such cookbook: docker+ 

+Expanded Run List:+ 
+------------------+ 
+* cookbook_sr::install+ 
+* cookbook_sr::docker-deploy+ 

+Platform:+ 
+---------+ 

マイレシピは

1)

case node[:platform] 
when "ubuntu","debian" 
    package "docker.io" do 
    action :install 
    end 
when 'centos','redhat','fedora','amazon' 
    package "docker" do 
    action :install 
    end 
end 

service "docker" do 
    action :start 
end 

2)ドッカー-deploy.rb

include_recipe 'deploy' 

node[:deploy].each do |application, deploy| 

    if node[:opsworks][:instance][:layers].first != deploy[:environment_variables][:layer] 
    Chef::Log.debug("Skipping deploy::docker application #{application} as it is not deployed to this layer") 
    next 
    end 

    opsworks_deploy_dir do 
    user deploy[:user] 
    group deploy[:group] 
    path deploy[:deploy_to] 
    end 

    opsworks_deploy do 
    deploy_data deploy 
    app application 
    end 

    bash "docker-cleanup" do 
    user "root" 
    code <<-EOH 
     if docker ps | grep #{deploy[:application]}; 
     then 
     docker stop #{deploy[:application]} 
     sleep 3 
     docker rm #{deploy[:application]} 
     sleep 3 
     fi 
     if docker images | grep #{deploy[:application]}; 
     then 
     docker rmi #{deploy[:application]} 
     fi 
    EOH 
    end 

    bash "docker-build" do 
    user "root" 
    cwd "#{deploy[:deploy_to]}/current" 
    code <<-EOH 
    docker build -t=#{deploy[:application]} . > #{deploy[:application]}-docker.out 
    EOH 
    end 

    dockerenvs = " " 
    deploy[:environment_variables].each do |key, value| 
    dockerenvs=dockerenvs+" -e "+key+"="+value 
    end 

    bash "docker-run" do 
    user "root" 
    cwd "#{deploy[:deploy_to]}/current" 
    code <<-EOH 
     docker run #{dockerenvs} -p #{node[:opsworks][:instance][:private_ip]}:#{deploy[:environment_variables][:service_port]}:#{deploy[:environment_variables][:container_port]} --name #{deploy[:application]} -d #{deploy[:application]} 
    EOH 
    end 

end 

3)metadata.rb

install.rb、あります
name    "creditcard_docker" 
maintainer  "xxxx" 
maintainer_email "[email protected]" 
license   "Apache 2.0" 
description  "AWS opsworks docker" 
version   "1.0" 

depends 'docker', '~> 2.0' 

マイドッキングウィンドウ層(12シェフ)

setup: cookbook_sr::install 
deploy: cookbook_sr::docker-deploy 

としてそれを設定する方法任意のアイデアを構成し、または従うべき任意のチュートリアルはありますか?

答えて

1

あなたの質問には、答えよりもむしろコメントでなければなりません(しかし、私はあまりにも少ない点があります)。

docker cookbookでBerksfileを作成しようとしましたか?

source 'https://supermarket.chef.io' 

metadata 

または

source 'https://supermarket.chef.io' 

cookbook "docker" 
関連する問題