我正在尝试让 Beaker 与启用 Upstart 的 Dockerfile 集成。这是我当前的节点集:
HOSTS:
ubuntu-server:
roles:
- master
platform: ubuntu-14.04-x64
image: ubuntu-upstart:14.04
hypervisor: docker
docker_cmd: '/sbin/init'
docker_preserve_image: true
docker_image_commands:
- wget --no-check-certificate https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
- apt-get install -y wget ca-certificates
- dpkg -i puppetlabs-release-trusty.deb
- apt-get update
- apt-get -y install puppet curl ntpdate git ruby
- "sed --in-place=.bak 's/without-password/yes/' /etc/ssh/sshd_config"
CONFIG:
log_level: verbose
type: foss
问题是,正如所见,这个容器从未启动过docker ps
。Beaker 还报告:
节点可用为ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] -p 49204
ubuntu-server 13:40:43$ dpkg -s curl
Warning: Try 1 -- Host 0.0.0.0 unreachable: connection closed by remote host
Warning: Trying again in 1 seconds
Warning: Try 2 -- Host 0.0.0.0 unreachable: Connection refused - connect(2) for "0.0.0.0" port 49204
Warning: Trying again in 1 seconds
Warning: Try 3 -- Host 0.0.0.0 unreachable: Connection refused - connect(2) for "0.0.0.0" port 49204
Warning: Trying again in 2 seconds
如果我将其替换docker_cmd
为:
docker_cmd: /usr/sbin/sshd -D
然后它可以工作,但没有 Upstart(这反过来会破坏测试)。
我可以这样做:docker ps -a
使用命令显示一些退出的容器:/bin/sh -c /sbin/init
我怎样才能让烧杯遵守docker_cmd
并且不被/sbin/init
耗尽/bin/sh
?
答案1
在你的 Gemfile 中,使用以下命令:
gem 'beaker', github: 'puppetlabs/beaker', branch: 'master'
他们解决了这个问题。
答案2
我通过替换解决了这个问题
docker_cmd: '/sbin/init'
和
docker_cmd: ['/sbin/init']