lib/kitchen/driver/docker.rb in kitchen-docker-0.5.0 vs lib/kitchen/driver/docker.rb in kitchen-docker-0.6.0
- old
+ new
@@ -34,10 +34,11 @@
default_config :port, '22'
default_config :username, 'kitchen'
default_config :password, 'kitchen'
default_config :require_chef_omnibus, true
default_config :remove_images, false
+ default_config :use_sudo, true
def verify_dependencies
run_command('docker > /dev/null', :quiet => true)
rescue
raise UserError,
@@ -65,13 +66,13 @@
from = "FROM #{config[:image]}"
platform = case config[:platform]
when 'debian', 'ubuntu'
<<-eos
ENV DEBIAN_FRONTEND noninteractive
+ RUN dpkg-divert --local --rename --add /sbin/initctl
RUN apt-get update
RUN apt-get install -y sudo openssh-server curl lsb-release
- RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initctl
eos
when 'rhel', 'centos'
<<-eos
RUN yum clean all
@@ -85,11 +86,10 @@
end
username = config[:username]
password = config[:password]
base = <<-eos
RUN mkdir -p /var/run/sshd
- RUN echo '127.0.0.1 localhost.localdomain localhost' >> /etc/hosts
RUN useradd -d /home/#{username} -m -s /bin/bash #{username}
RUN echo #{username}:#{password} | chpasswd
RUN echo '#{username} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
eos
custom = ''
@@ -123,10 +123,10 @@
container_id
end
def build_run_command(image_id)
cmd = 'docker run -d'
- Array(config[:foward]).each {|port| cmd << " -p #{port}"}
+ Array(config[:forward]).each {|port| cmd << " -p #{port}"}
Array(config[:dns]).each {|dns| cmd << " -dns #{dns}"}
Array(config[:volume]).each {|volume| cmd << " -v #{volume}"}
cmd << " -m #{config[:memory]}" if config[:memory]
cmd << " -c #{config[:cpu]}" if config[:cpu]
cmd << " #{image_id} /usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no"