【问题标题】:Kitchen lxc not finding container厨房 lxc 找不到容器
【发布时间】:2014-03-04 22:44:28
【问题描述】:

我正在尝试使用 LXC 使用我的实际测试套件运行厨房,我尝试将厨房委托给 vagrant-lxc 和 kitchen-lxc 都没有任何运气。 使用 kitchen-lxc 我的 kitchen.yml 看起来是这样的:

driver_plugin: lxc
driver_config:
  require_chef_omnibus: false

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-12.04
    driver_config:
      base_container: "opscode-ubuntu-12.04"
      username: ubuntu
      password: ubuntu

suites:
  - name: default
    run_list:
      - recipe[project::default]

当我运行厨房测试时,我得到了

Failed to complete #create action: [Permission denied - /var/lib/lxc/opscode-ubuntu-12.04-L1qycdk8K0J0/config] (Kitchen::ActionFailed)

在这种情况下,我有一个 vagrant-lxc 盒子,我没有配置路径或其他东西来告诉厨房容器在哪里,怎么做?

使用 vagrant-lxc 插件,我以这种方式配置了 kitchen.yml:

---
driver:
  name: vagrant
  require_chef_omnibus: false
  require_chef_berkshelf: true
  driver_config:
    require_chef_omnibus: false
    provider: lxc

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-12.04
    driver_config:
      box: "opscode-ubuntu-12.04"
      box_url: "http://dl.company.com/boxes/vagrant-lxc-precise-amd64.box"

suites:
  - name: default
    run_list:
      - recipe[project::default]

在这种情况下,这是我得到的:

["sudo", "lxc-create", "--template", "vagrant-tmp-opscode-ubuntu-1204_default_1393616342539_80654", "--name", "opscode-ubuntu-1204_default_1393616342539_80654", "-f", "/home/user/.vagrant.d/boxes/opscode-ubuntu-12.04/lxc/lxc.conf", "--", "--tarball", "/home/user/.vagrant.d/boxes/opscode-ubuntu-12.04/lxc/rootfs.tar.gz", "--auth-key", "/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/keys/vagrant.pub"]

我认为问题出在模板名称上,但我可能错了,问题出在哪里?

无论我想解决我的问题,请提供一些建议。

忘了告诉使用纯 Vagrantfile 和 vagrant-lxc 运行 lxc 容器可以正常工作,所以不是工具问题。

【问题讨论】:

    标签: chef-infra vagrant lxc test-kitchen


    【解决方案1】:

    我最终通过 Vagrant 使用了 kitchen-vagrant 和 LXC,而不是使用 kitchen-lxc。 因此它将是方法 2 并进行一些更改,如下所示:

    ---
    driver:
      name: vagrant
      require_chef_omnibus: false
      require_chef_berkshelf: true
      driver_config:
        require_chef_omnibus: false
    
    provisioner:
      name: chef_solo
    
    platforms:
      - name: ubuntu-12.04
        driver:
          box: "ubuntu-12.04"
          box_url: "http://dl.company.com/boxes/vagrant-lxc-precise-amd64.box"
          provider: lxc
    

    另外,作为建议,在开始测试厨房工作流程之前,应确保您使用的 vagrant-lxc 框在 vagran-lxc 下正常工作,

    希望对其他人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-17
      • 1970-01-01
      • 2017-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多