lib/beaker/hypervisor/docker.rb in beaker-3.16.0 vs lib/beaker/hypervisor/docker.rb in beaker-3.17.0
- old
+ new
@@ -244,13 +244,16 @@
RUN mkdir -p /var/run/sshd
RUN echo root:#{root_password} | chpasswd
EOF
# Configure sshd service to allowroot login using password
+ # Also, disable reverse DNS lookups to prevent every. single. ssh
+ # operation taking 30 seconds while the lookup times out.
dockerfile += <<-EOF
RUN sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/^#?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config
+ RUN sed -ri 's/^#?UseDNS .*/UseDNS no/' /etc/ssh/sshd_config
EOF
# Any extra commands specified for the host
dockerfile += (host['docker_image_commands'] || []).map { |command|
@@ -283,9 +286,12 @@
container.exec(['sed','-ri',
's/^#?PermitRootLogin .*/PermitRootLogin yes/',
'/etc/ssh/sshd_config'])
container.exec(['sed','-ri',
's/^#?PasswordAuthentication .*/PasswordAuthentication yes/',
+ '/etc/ssh/sshd_config'])
+ container.exec(['sed','-ri',
+ 's/^#?UseDNS .*/UseDNS no/',
'/etc/ssh/sshd_config'])
container.exec(%w(service ssh restart))
end