2016-05-12 87 views
1

我正在尝试构建配备厨师的码头图像。它适用于我以下的Dockerfile和厨师食谱。配置厨师的码头图像

#Dockerfile 
FROM centos:7 
RUN yum install -y wget 
RUN wget https://packages.chef.io/stable/el/7/chefdk-0.13.21-1.el7.x86_64.rpm 
RUN yum install -y chefdk-0.13.21-1.el7.x86_64.rpm 
COPY cookbooks cookbooks 
RUN cd cookbooks/hs_price_verification && berks install && berks vendor cookbooks && chef-client -z --override-runlist hs_price_verification 

#default.rb 
include_recipe 'git' 
package 'yum-utils' 
execute 'yum --enablerepo=base clean metadata' 
execute 'yum update -y || true' 
execute 'yum-config-manager --enable cr' 
domain=node['domainsname'] 

但是如果我移动厨师-client命令盘升线在Dockerfile

... 
RUN cd cookbooks/hs_price_verification && berks install && berks vendor cookbooks 
RUN chef-client -z --override-runlist hs_price_verification 

我得到一个错误

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

Missing Cookbooks: 
------------------ 
No such cookbook: git 

它像“伯克斯安装&结果& berks vendor cookbooks'在Dockerfile的同一行上可用,当我移动该命令时'cache'丢失。

任何人都可以解释一下吗?

回答

1

码头运行在其自己的命令中的每个RUN行,这意味着从行前cd在那里没有影响。