【问题标题】:Provisioning a docker image with chef使用 chef 配置 docker 映像
【发布时间】:2016-05-13 04:12:54
【问题描述】:

我正在尝试构建一个使用 chef 配置的 docker 映像。它适用于以下 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']

但是,如果我将 chef-client 命令移动到 Dockerfile 中自己的 RUN 行

...
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 install && berks vendor cookbooks”的结果在 Dockerfile 的同一行上可用,当我移动命令时,“缓存”丢失了。

谁能解释一下?

【问题讨论】:

    标签: docker chef-infra berkshelf


    【解决方案1】:

    Docker 在自己的命令中运行每个RUN 行,这意味着之前行中的cd 在那里无效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-03
      • 1970-01-01
      • 1970-01-01
      • 2019-11-06
      • 1970-01-01
      • 1970-01-01
      • 2020-03-30
      • 1970-01-01
      相关资源
      最近更新 更多