lib/beaker/hypervisor/docker.rb in beaker-1.21.0 vs lib/beaker/hypervisor/docker.rb in beaker-2.0.0
- old
+ new
@@ -6,11 +6,11 @@
@options = options
@logger = options[:logger]
@hosts = hosts
# increase the http timeouts as provisioning images can be slow
- ::Docker.options = { :write_timeout => 300, :read_timeout => 300 }
+ ::Docker.options = { :write_timeout => 300, :read_timeout => 300 }.merge(::Docker.options || {})
# assert that the docker-api gem can talk to your docker
# enpoint. Will raise if there is a version mismatch
::Docker.validate_version!
# Pass on all the logging from docker-api to the beaker logger instance
::Docker.logger = @logger
@@ -109,15 +109,22 @@
sshd_options = ''
# add platform-specific actions
case host['platform']
when /ubuntu/, /debian/
+ sshd_options = '-o "PermitRootLogin yes" -o "PasswordAuthentication yes"'
dockerfile += <<-EOF
RUN apt-get update
RUN apt-get install -y openssh-server openssh-client #{Beaker::HostPrebuiltSteps::DEBIAN_PACKAGES.join(' ')}
EOF
- when /^el-/, /centos/, /fedora/, /redhat/
+ when /cumulus/
+ sshd_options = '-o "PermitRootLogin yes" -o "PasswordAuthentication yes"'
+ dockerfile += <<-EOF
+ RUN apt-get update
+ RUN apt-get install -y openssh-server openssh-client #{Beaker::HostPrebuiltSteps::CUMULUS_PACKAGES.join(' ')}
+ EOF
+ when /^el-/, /centos/, /fedora/, /redhat/, /eos/
dockerfile += <<-EOF
RUN yum clean all
RUN yum install -y sudo openssh-server openssh-clients #{Beaker::HostPrebuiltSteps::UNIX_PACKAGES.join(' ')}
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
@@ -142,9 +149,14 @@
# Any extra commands specified for the host
dockerfile += (host['docker_image_commands'] || []).map { |command|
"RUN #{command}\n"
}.join('')
+
+ # Override image entrypoint
+ if host['docker_image_entrypoint']
+ dockerfile += "ENTRYPOINT #{host['docker_image_entrypoint']}\n"
+ end
# How to start a sshd on port 22. May be an init for more supervision
cmd = host['docker_cmd'] || "/usr/sbin/sshd -D #{sshd_options}"
dockerfile += <<-EOF
EXPOSE 22