![带有 docker 和 ubuntu-upstart 镜像的 Beaker 无法启动容器](https://linux22.com/image/643819/%E5%B8%A6%E6%9C%89%20docker%20%E5%92%8C%20ubuntu-upstart%20%E9%95%9C%E5%83%8F%E7%9A%84%20Beaker%20%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%E5%AE%B9%E5%99%A8.png)
我正在尝试让 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']