gpt4 book ai didi

macos - 类:厨房::ActionFailed-测试厨房+ Docker +远程API

转载 作者:行者123 更新时间:2023-12-02 19:43:47 26 4
gpt4 key购买 nike

我试图在Mac(OS X Mavericks)上使用测试厨房(安装了ChefDK和docker-api驱动程序)在远程服务器上创建docker实例,但似乎在最后一步几乎失败了:

stardust:test_kitchen rilindo$ kitchen create
-----> Starting Kitchen (v1.2.1)
-----> Creating <default-centos-64>...
Step 0 : FROM centos:centos6
---> 68edf809afe7
Step 1 : RUN yum clean all
---> Using cache
---> 79fd0e4588de
Step 2 : RUN yum install -y sudo openssh-server openssh-clients curl
---> Using cache
---> 131f54051dc4
Step 3 : RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
---> Using cache
---> d05a99414427
Step 4 : RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
---> Using cache
---> 53636accc8b7
Step 5 : RUN mkdir -p /var/run/sshd
---> Using cache
---> fa875c2e9f1a
Step 6 : RUN useradd -d /home/kitchen -m -s /bin/bash kitchen
---> Using cache
---> 962000c5929d
Step 7 : RUN echo kitchen:kitchen | chpasswd
---> Using cache
---> f22dcbca6292
Step 8 : RUN echo 'kitchen ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
---> Using cache
---> cb9d8b95eb33
Successfully built cb9d8b95eb33
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [undefined method `[]' for nil:NilClass]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

尝试创建容器端口时,该部分似乎失败了:
stardust:test_kitchen rilindo$ tail -30 .kitchen/logs/kitchen.log 
I, [2014-10-09T23:46:59.460656 #1112] INFO -- Kitchen: -----> Starting Kitchen (v1.2.1)
I, [2014-10-09T23:46:59.525462 #1112] INFO -- Kitchen: -----> Destroying <default-centos-64>...
I, [2014-10-09T23:47:02.720005 #1112] INFO -- Kitchen: -----> Kitchen is finished. (0m3.26s)
I, [2014-10-09T23:48:49.778602 #1118] INFO -- Kitchen: -----> Starting Kitchen (v1.2.1)
I, [2014-10-09T23:48:49.842909 #1118] INFO -- Kitchen: -----> Creating <default-centos-64>...
E, [2014-10-09T23:48:52.826223 #1118] ERROR -- Kitchen: ------Exception-------
E, [2014-10-09T23:48:52.826280 #1118] ERROR -- Kitchen: Class: Kitchen::ActionFailed
E, [2014-10-09T23:48:52.826322 #1118] ERROR -- Kitchen: Message: Failed to complete #create action: [undefined method `[]' for nil:NilClass]
E, [2014-10-09T23:48:52.826363 #1118] ERROR -- Kitchen: ---Nested Exception---
E, [2014-10-09T23:48:52.826403 #1118] ERROR -- Kitchen: Class: NoMethodError
E, [2014-10-09T23:48:52.826442 #1118] ERROR -- Kitchen: Message: undefined method `[]' for nil:NilClass
E, [2014-10-09T23:48:52.826481 #1118] ERROR -- Kitchen: ------Backtrace-------
E, [2014-10-09T23:48:52.826520 #1118] ERROR -- Kitchen: /Users/rilindo/.chefdk/gem/ruby/2.1.0/gems/kitchen-docker-api-0.4.0/lib/kitchen/driver/docker.rb:228:in `container_ssh_port'
E, [2014-10-09T23:48:52.826560 #1118] ERROR -- Kitchen: /Users/rilindo/.chefdk/gem/ruby/2.1.0/gems/kitchen-docker-api-0.4.0/lib/kitchen/driver/docker.rb:82:in `create'
E, [2014-10-09T23:48:52.826600 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:273:in `public_send'
E, [2014-10-09T23:48:52.826641 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:273:in `block in perform_action'
E, [2014-10-09T23:48:52.826681 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:308:in `call'
E, [2014-10-09T23:48:52.826760 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:308:in `synchronize_or_call'
E, [2014-10-09T23:48:52.826802 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:283:in `block in action'
E, [2014-10-09T23:48:52.826842 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
E, [2014-10-09T23:48:52.826882 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:282:in `action'
E, [2014-10-09T23:48:52.826921 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:273:in `perform_action'
E, [2014-10-09T23:48:52.826961 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:252:in `create_action'
E, [2014-10-09T23:48:52.827001 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:246:in `block in transition_to'
E, [2014-10-09T23:48:52.827041 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:245:in `each'
E, [2014-10-09T23:48:52.827081 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:245:in `transition_to'
E, [2014-10-09T23:48:52.827149 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/instance.rb:108:in `create'
E, [2014-10-09T23:48:52.827189 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/command.rb:109:in `public_send'
E, [2014-10-09T23:48:52.827229 #1118] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/command.rb:109:in `block (2 levels) in run_action'
E, [2014-10-09T23:48:52.827269 #1118] ERROR -- Kitchen: ----------------------

我不确定问题是否出在我的.kitchen.yaml中,端口是否正确转发。当然,这可能是一个完全不同的问题:
---
driver:
name: docker
socket: tcp://111.222.333.444:4243

provisioner:
name: chef_solo

platforms:
- name: centos-6.4
driver_config:
image: centos:centos6
platform: centos
forward:
- 22:2222

suites:
- name: default
run_list:
attributes:

我正在唱歌adnichols / kitchen-docker-api驱动程序,顺便说一句。

最佳答案

事实证明,它失败是因为docker无法分配端口:

Oct 10 22:05:04 traeger docker: [error] server.go:1013 Error: Cannot start container e92342347ce6e372ffcada89724067bc2878f00d5679e26ea849d4f49f275e1e: port has already been allocated
Oct 10 22:05:04 traeger docker: [error] server.go:90 HTTP Error: statusCode=500 Cannot start container e92342347ce6e372ffcada89724067bc2878f00d5679e26ea849d4f49f275e1e: port has already been allocated

在我的情况下,forward参数不是必需的。这是我现在正确的配置:
---
driver:
name: docker
socket: tcp://111.222.333.444:4243

provisioner:
name: chef_solo

platforms:
- name: ubuntu-12.04
driver_config:
privileged: true
container_name: ubuntu_test_1204
image: ubuntu:12.04
platform: ubuntu
- name: centos-6.4
driver_config:
privileged: true
container_name: centos_test_6
image: centos:centos6
platform: centos

suites:
- name: default
run_list:
attributes:

现在,我可以连接到我的实例了:
mylaptop:test_kit rilindo$ kitchen create default-centos-64
-----> Starting Kitchen (v1.2.1)
-----> Creating <default-centos-64>...
Step 0 : FROM centos:centos6
---> 68edf809afe7
Step 1 : RUN yum clean all
---> Using cache
---> 79fd0e4588de
Step 2 : RUN yum install -y sudo openssh-server openssh-clients curl
---> Using cache
---> 131f54051dc4
Step 3 : RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
---> Using cache
---> d05a99414427
Step 4 : RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
---> Using cache
---> 53636accc8b7
Step 5 : RUN mkdir -p /var/run/sshd
---> Using cache
---> fa875c2e9f1a
Step 6 : RUN useradd -d /home/kitchen -m -s /bin/bash kitchen
---> Using cache
---> 962000c5929d
Step 7 : RUN echo kitchen:kitchen | chpasswd
---> Using cache
---> f22dcbca6292
Step 8 : RUN echo 'kitchen ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
---> Using cache
---> cb9d8b95eb33
Successfully built cb9d8b95eb33
Finished creating <default-centos-64> (0m3.70s).
-----> Kitchen is finished. (0m3.77s)
my laptop:test_kit rilindo$ kitchen login default-centos-64
kitchen@111.222.333.444's password:
[kitchen@2bdd84c99337 ~]$ exit

关于macos - 类:厨房::ActionFailed-测试厨房+ Docker +远程API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26292216/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com