New Upstream Release - ruby-kitchen-docker
Ready changes
Summary
Merged new upstream version: 2.13.0 (was: 2.10.0).
Resulting package
Built on 2023-01-07T17:24 (took 5m52s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases ruby-kitchen-docker
Lintian Result
Diff
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..452ebb3
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,7 @@
+version: 2
+updates:
+- package-ecosystem: bundler
+ directory: "/"
+ schedule:
+ interval: daily
+ open-pull-requests-limit: 10
diff --git a/.gitignore b/.gitignore
index 9a33d84..9106b64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,5 +17,5 @@ test/version_tmp
tmp
.kitchen/
.kitchen.local.yml
-Dockerfile*
+Dockerfile
.DS_Store
diff --git a/.kitchen.windows.yml b/.kitchen.windows.yml
index a8d09aa..b58b915 100644
--- a/.kitchen.windows.yml
+++ b/.kitchen.windows.yml
@@ -18,7 +18,7 @@ provisioner:
platforms:
- name: windows
driver_config:
- image: mcr.microsoft.com/windows/servercore:1803
+ image: mcr.microsoft.com/windows/servercore:1809
platform: windows
suites:
diff --git a/.kitchen.yml b/.kitchen.yml
index 0eb07c6..ab46fa8 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -14,31 +14,21 @@ provisioner:
platforms:
- name: amazonlinux-2
-- name: ubuntu-16.04
- name: ubuntu-18.04
+- name: ubuntu-20.04
- name: fedora-latest
driver:
provision_command:
- - yum install libxcrypt-compat.x86_64 -y
+ - yum install libxcrypt-compat -y
- curl -L https://www.chef.io/chef/install.sh | bash
-- name: centos-6
- name: centos-7
-- name: oraclelinux-6
- name: oraclelinux-7
-- name: debian-8
+- name: rockylinux-8
- name: debian-9
-- name: opensuse-42.3
+- name: debian-10
+- name: opensuse-15
driver:
- image: opensuse/leap:42.3
-- name: opensuse/leap-42
-# - name: arch
-# driver:
-# image: base/archlinux
-# provision_command: true
-- name: unknown
- driver:
- image: ubuntu:16.04
- platform: ubuntu
+ image: opensuse/leap:15
- name: dockerfile
driver:
username: dockerfile
@@ -48,19 +38,26 @@ platforms:
suites:
- name: default
- excludes: [arch]
+ excludes: [arch, debian-9]
- name: context
- excludes: [arch]
+ excludes: [arch, debian-9]
driver:
build_context: false
- name: capabilities
- includes: [debian-8,debian-9,ubuntu-16.04,ubuntu-18.04]
+ includes: [debian-10,ubuntu-18.04,ubuntu-20.04]
driver:
provision_command:
- curl -L https://www.chef.io/chef/install.sh | bash
- apt-get install -y net-tools
cap_drop:
- NET_ADMIN
+- name: arm64
+ excludes: [debian-9]
+ driver:
+ docker_platform: linux/arm64
+- name: amd64
+ driver:
+ docker_platform: linux/amd64
- name: inspec
driver:
provision_command: true
diff --git a/.travis.yml b/.travis.yml
index 3d092c0..065c834 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,15 +33,20 @@ matrix:
- os: windows
language: bash
install:
+ - choco uninstall ruby
+ - choco install ruby --version=2.6.5.1
+ - export PATH=$(echo "$PATH" | sed -e 's/:\/c\/tools\/ruby27\/bin//')
+ - export PATH=$PATH:/c/tools/ruby26/bin
- choco install mingw
- choco install msys2
- - ridk.cmd exec pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain
+ - ridk.cmd exec pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-libxslt
script:
- - taskkill -IM "gpg-agent.exe" -F
+ - if [[ $(tasklist | grep "gpg-agent") ]]; then taskkill -IM "gpg-agent.exe" -F; else echo "Process gpg-agent not found. Skipping."; fi
- powershell -ExecutionPolicy Bypass -NoLogo -File docker.ps1
- export KITCHEN_YAML=.kitchen.windows.yml
- ruby -v
- gem install bundler
+ - bundle config build.nokogiri --use-system-libraries
- bundle install
- bundle exec docker version
- bundle exec kitchen --version
diff --git a/CHANGELOG.md b/CHANGELOG.md
index beb173b..904c2e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,110 +1,120 @@
# Kitchen-Docker Changelog
+## 2.13.0 - June 10, 2022
+
+- Added CentOSStream and PhotonOS - [@garethgreenaway](https://github.com/garethgreenaway)
+- Fixed image parser when output includes a duration timestamp - [@RulerOf](https://github.com/RulerOf)
+- Updated the test suites - [@RulerOf](https://github.com/RulerOf)
+
+## 2.12.0 - December 22, 2021
+
+- Support Docker BuildKit - [@RulerOf](https://github.com/RulerOf)
+- Add new `docker_platform` config to allow specifying architectures - [@RulerOf](https://github.com/RulerOf)
+
+## 2.11.0 - July 2, 2021
+
+- Update the development dependency on kitchen-inspec to 2.x
+- Retrieve hostname state data after container is launched to avoid failures when `use_internal_docker_network` is set
+- Add a new option for setting container isolation. See the readme for additional details
+- Support GPUs in containers with a new `gpus` option that takes the same arguments that would be passed to `docker run --gpus`
+- suse platform: use system script for ssh key initialization
+- Add support for the `--mount` docker CLI option. See the readme for additional details
+- Use sudo.d files instead of directly editing the sudoers file
+- Allow passing `--tmpfs` entries to the docker run command. See the readme for additional details
+- Use less verbose and quicker setup on Gentoo
+- Lowercase the instance-name to avoid issues since docker does not allow instance with capital cases
+- Fix the error "Could not parse Docker build output for image ID" by improving the output line matching
+- Add support for `almalinux` & `rockylinux`
+
## 2.10.0 - Mar 28, 2020
-* Switched from require to require_relative to slightly improve load time performance
-* Allow for train gem 3.x
-* Refactor driver to include Windows support (includes new transport for all supported platforms)
+- Switched from require to require_relative to slightly improve load time performance
+- Allow for train gem 3.x
+- Refactor driver to include Windows support (includes new transport for all supported platforms)
## 2.9.0 - Mar 15, 2019
-* Add automatic OS detection for amazonlinux, opensuse/leap, and opensuse/tumbleweed
-* On Fedora containers uses dnf to setup the OS not yum
+- Add automatic OS detection for amazonlinux, opensuse/leap, and opensuse/tumbleweed
+- On Fedora containers uses dnf to setup the OS not yum
## 2.8.0 - Jan 18, 2019
-* Add new config option `use_internal_docker_network`, which allows running Docker within Docker. See readme for usage details.
-* Resolve errors while loading libraries on archlinux
-* Fix failures on Ubuntu 18.04
-* Check if image exists before attempting to remove it so we don't fail
-* Add oraclelinux platform support
-* Prevent `uninitialized constant Kitchen::Driver::Docker::Base64` error by requiring `base64`
+- Add new config option `use_internal_docker_network`, which allows running Docker within Docker. See readme for usage details.
+- Resolve errors while loading libraries on archlinux
+- Fix failures on Ubuntu 18.04
+- Check if image exists before attempting to remove it so we don't fail
+- Add oraclelinux platform support
+- Prevent `uninitialized constant Kitchen::Driver::Docker::Base64` error by requiring `base64`
## 2.7.0
-* Support for SUSE-based container images.
-* Improved support for build context shipping.
-* Changed `use_sudo` to default to `false` in keeping with modern Docker usage.
+- Support for SUSE-based container images.
+- Improved support for build context shipping.
+- Changed `use_sudo` to default to `false` in keeping with modern Docker usage.
## 2.6.0
-* Set container name with information from the run so you can identify them
+- Set container name with information from the run so you can identify them
later on.
-* Upgrade to new driver base class structure.
+- Upgrade to new driver base class structure.
## 2.5.0
-* [#209](https://github.com/portertech/kitchen-docker/pulls/209) Fix usage with Kitchen rake tasks.
-* Add `run_options` and `build_options` configuration.
-* [#195](https://github.com/portertech/kitchen-docker/pulls/195) Fix Arch Linux support.
-* Fix shell escaping for build paths and SSH keys.
+- [#209](https://github.com/portertech/kitchen-docker/pulls/209) Fix usage with Kitchen rake tasks.
+- Add `run_options` and `build_options` configuration.
+- [#195](https://github.com/portertech/kitchen-docker/pulls/195) Fix Arch Linux support.
+- Fix shell escaping for build paths and SSH keys.
## 2.4.0
-* [#148](https://github.com/portertech/kitchen-docker/issues/148) Restored support for older versions of Ruby.
-* [#149](https://github.com/portertech/kitchen-docker/pulls/149) Handle connecting to a container directly as root.
-* [#154](https://github.com/portertech/kitchen-docker/pulls/154) Improve container caching by reordering the build steps.
-* [#176](https://github.com/portertech/kitchen-docker/pulls/176) Expose proxy environment variables to the container automatically.
-* [#192](https://github.com/portertech/kitchen-docker/pulls/192) Set `$container=docker` for CentOS images.
-* [#196](https://github.com/portertech/kitchen-docker/pulls/196) Mutex SSH key generation for use with `kitchen -c`.
-* [#192](https://github.com/portertech/kitchen-docker/pulls/192) Don't wait when stopping a container.
+- [#148](https://github.com/portertech/kitchen-docker/issues/148) Restored support for older versions of Ruby.
+- [#149](https://github.com/portertech/kitchen-docker/pulls/149) Handle connecting to a container directly as root.
+- [#154](https://github.com/portertech/kitchen-docker/pulls/154) Improve container caching by reordering the build steps.
+- [#176](https://github.com/portertech/kitchen-docker/pulls/176) Expose proxy environment variables to the container automatically.
+- [#192](https://github.com/portertech/kitchen-docker/pulls/192) Set `$container=docker` for CentOS images.
+- [#196](https://github.com/portertech/kitchen-docker/pulls/196) Mutex SSH key generation for use with `kitchen -c`.
+- [#192](https://github.com/portertech/kitchen-docker/pulls/192) Don't wait when stopping a container.
## 2.3.0
-* `build_context` option (boolean) to enable/disable sending the build
+- `build_context` option (boolean) to enable/disable sending the build
context to Docker.
## 2.2.0
-* Use a temporary file for each suite instance Docker container
+- Use a temporary file for each suite instance Docker container
Dockerfile, instead of passing their contents via STDIN. This allows for
the use of commands like ADD and COPY. **Users must now use Docker >= 1.5.0**
-
-* Passwordless suite instance Docker container login (SSH), using a
+- Passwordless suite instance Docker container login (SSH), using a
generated key pair.
-
-* Support for sharing a host device with suite instance Docker containers.
-
-* README YAML highlighting.
+- Support for sharing a host device with suite instance Docker containers.
+- README YAML highlighting.
## 2.1.0
-* Use `NUL` instead of `/dev/null` on Windows for output redirection
+- Use `NUL` instead of `/dev/null` on Windows for output redirection
## 2.0.0
-* Use Docker `top` and `port` instead of `inspect`
-
-* Don't create the kitchen user if it already exists
-
-* Docker container capabilities options: cap_add, cap_drop
-
-* Docker security profile option (SELinux/AppArmor): security_opt
-
-* wait_for_sshd option (boolean)
-
-* Create `/etc/sudoers.d` if missing
-
-* Fixed option deprecation warnings, require Docker >= 1.2
+- Use Docker `top` and `port` instead of `inspect`
+- Don't create the kitchen user if it already exists
+- Docker container capabilities options: cap_add, cap_drop
+- Docker security profile option (SELinux/AppArmor): security_opt
+- wait_for_sshd option (boolean)
+- Create `/etc/sudoers.d` if missing
+- Fixed option deprecation warnings, require Docker >= 1.2
## 1.7.0
-* Ensure a container id is set before attempting to inspect a container
+- Ensure a container id is set before attempting to inspect a container
## 1.6.0
-* `publish_all` option to publish all ports to the host interface
-
-* `instance_name` option to name the Docker container
-
-* `links` option to link suite instance Docker containers
-
-* `socket` option will now default to ENV `DOCKER_HOST` if set
-
-* Fixed verify dependencies output redirection
-
-* Added `fedora` to platform names
-
-* Support for `gentoo` and `gentoo-paludis` platforms
-
-* Adding sudo rule to `/etc/sudoers.d/#{username}` in addition to `/etc/sudoers`
+- `publish_all` option to publish all ports to the host interface
+- `instance_name` option to name the Docker container
+- `links` option to link suite instance Docker containers
+- `socket` option will now default to ENV `DOCKER_HOST` if set
+- Fixed verify dependencies output redirection
+- Added `fedora` to platform names
+- Support for `gentoo` and `gentoo-paludis` platforms
+- Adding sudo rule to `/etc/sudoers.d/#{username}` in addition to `/etc/sudoers`
diff --git a/README.md b/README.md
index ad21148..3a36fa1 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,8 @@
A Test Kitchen Driver and Transport for Docker.
+***MAINTAINERS WANTED***: This Test-Kitchen driver is currently without a maintainer and has many known issues. If you're interested in maintaining this driver for the long run including expanding the CI testing please reach out on [Chef Community Slack: #test-kitchen](https://chefcommunity.slack.com/archives/C2B6G1WCQ). Until such a time that this driver is maintained we highly recommend the [kitchen-dokken](https://github.com/test-kitchen/kitchen-dokken) for Chef Infra testing with Docker containers.
+
## Requirements
* [Docker][docker_installation] **(>= 1.5)**
@@ -23,7 +25,7 @@ driver:
name: docker
env_variables:
TEST_KEY: TEST_VALUE
-
+
platforms:
- name: ubuntu
run_list:
@@ -109,8 +111,8 @@ Examples:
### socket
-The Docker daemon socket to use. By default, Docker will listen on `unix:///var/run/docker.sock` (On Windows, `npipe:////./pipe/docker_engine`),
-and no configuration here is required. If Docker is binding to another host/port or Unix socket, you will need to set this option.
+The Docker daemon socket to use. By default, Docker will listen on `unix:///var/run/docker.sock` (On Windows, `npipe:////./pipe/docker_engine`),
+and no configuration here is required. If Docker is binding to another host/port or Unix socket, you will need to set this option.
If a TCP socket is set, its host will be used for SSH access to suite containers.
Examples:
@@ -164,6 +166,19 @@ images using the [Docker Index][docker_index].
The default will be computed, using the platform name (see the Default
Configuration section for more details).
+### isolation
+
+The isolation technology for the container. This is not set by default and will use the default container isolation settings.
+
+For example, the following driver configuration options can be used to specify the container isolation technology for Windows containers:
+```yaml
+# Hyper-V
+isolation: hyperv
+
+# Process
+isolation: process
+```
+
### platform
The platform of the chosen image. This is used to properly bootstrap the
@@ -171,7 +186,7 @@ suite container for Test Kitchen. Kitchen Docker currently supports:
* `arch`
* `debian` or `ubuntu`
-* `amazonlinux`, `rhel`, `centos`, `fedora` or `oraclelinux`
+* `amazonlinux`, `rhel`, `centos`, `fedora`, `oraclelinux`, `almalinux` or `rockylinux`
* `gentoo` or `gentoo-paludis`
* `opensuse/tumbleweed`, `opensuse/leap`, `opensuse` or `sles`
* `windows`
@@ -312,6 +327,39 @@ Examples:
- rvm
```
+### mount
+
+Attach a filesystem mount to the container (**NOTE:** supported only in docker
+17.05 and newer).
+
+Examples:
+
+```yaml
+ mount: type=volume,source=my-volume,destination=/path/in/container
+```
+
+```yaml
+ mount:
+ - type=volume,source=my-volume,destination=/path/in/container
+ - type=tmpfs,tmpfs-size=512M,destination=/path/to/tmpdir
+```
+
+### tmpfs
+
+Adds a tmpfs volume(s) to the suite container.
+
+Examples:
+
+```yaml
+ tmpfs: /tmp
+```
+
+```yaml
+ tmpfs:
+ - /tmp:exec
+ - /run
+```
+
### dns
Adjusts `resolv.conf` to use the dns servers specified. Otherwise use
@@ -548,6 +596,20 @@ Examples:
use_internal_docker_network: true
```
+### docker_platform
+
+Configure the CPU platform (architecture) used by docker to build the image.
+
+Examples:
+
+```yaml
+ docker_platform: linux/arm64
+```
+
+```yaml
+ docker_platform: linux/amd64
+```
+
## Development
* Source hosted at [GitHub][repo]
@@ -587,7 +649,7 @@ limitations under the License.
[docker_upstart_issue]: https://github.com/dotcloud/docker/issues/223
[docker_index]: https://index.docker.io/
[docker_default_image]: https://index.docker.io/_/base/
-[test_kitchen_docs]: http://kitchen.ci/docs/getting-started/
+[test_kitchen_docs]: https://kitchen.ci/docs/getting-started/introduction/
[chef_omnibus_dl]: https://downloads.chef.io/chef-client/
[cpu_shares]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html
[memory_limit]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-memory.html
diff --git a/debian/changelog b/debian/changelog
index 210f676..0ff055f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
-ruby-kitchen-docker (2.10.0-2) UNRELEASED; urgency=medium
+ruby-kitchen-docker (2.13.0-1) UNRELEASED; urgency=medium
* Update standards version to 4.6.2, no changes needed.
+ * New upstream release.
- -- Debian Janitor <janitor@jelmer.uk> Sat, 07 Jan 2023 05:41:45 -0000
+ -- Debian Janitor <janitor@jelmer.uk> Sat, 07 Jan 2023 17:19:48 -0000
ruby-kitchen-docker (2.10.0-1) unstable; urgency=medium
diff --git a/kitchen-docker.gemspec b/kitchen-docker.gemspec
index f75a335..08474a9 100644
--- a/kitchen-docker.gemspec
+++ b/kitchen-docker.gemspec
@@ -34,6 +34,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'codecov', '~> 0.0', '>= 0.0.2'
# Integration testing gems.
- spec.add_development_dependency 'kitchen-inspec', '~> 1.1'
+ spec.add_development_dependency 'kitchen-inspec', '~> 2.0'
spec.add_development_dependency 'train', '>= 2.1', '< 4.0' # validate 4.x when it's released
end
diff --git a/lib/kitchen/docker/container.rb b/lib/kitchen/docker/container.rb
index 83624b6..2595dfe 100644
--- a/lib/kitchen/docker/container.rb
+++ b/lib/kitchen/docker/container.rb
@@ -37,13 +37,27 @@ module Kitchen
end
state[:username] = @config[:username]
- state[:hostname] = 'localhost'
+ end
+
+ def destroy(state)
+ info("[Docker] Destroying Docker container #{state[:container_id]}") if state[:container_id]
+ remove_container(state) if container_exists?(state)
+
+ if @config[:remove_images] && state[:image_id]
+ remove_image(state) if image_exists?(state)
+ end
+ end
+
+ def hostname(state)
+ hostname = 'localhost'
if remote_socket?
- state[:hostname] = socket_uri.host
- elsif config[:use_internal_docker_network]
- state[:hostname] = container_ip_address(state)
+ hostname = socket_uri.host
+ elsif @config[:use_internal_docker_network]
+ hostname = container_ip_address(state)
end
+
+ hostname
end
def upload(locals, remote)
@@ -56,15 +70,6 @@ module Kitchen
files
end
-
- def destroy(state)
- info("[Docker] Destroying Docker container #{state[:container_id]}") if state[:container_id]
- remove_container(state) if container_exists?(state)
-
- if @config[:remove_images] && state[:image_id]
- remove_image(state) if image_exists?(state)
- end
- end
end
end
end
diff --git a/lib/kitchen/docker/container/linux.rb b/lib/kitchen/docker/container/linux.rb
index 5b9d0ef..e2650b8 100644
--- a/lib/kitchen/docker/container/linux.rb
+++ b/lib/kitchen/docker/container/linux.rb
@@ -17,11 +17,14 @@ require 'securerandom'
require 'shellwords'
require_relative '../container'
+require_relative '../helpers/dockerfile_helper'
module Kitchen
module Docker
class Container
class Linux < Kitchen::Docker::Container
+ include Kitchen::Docker::Helpers::DockerfileHelper
+
MUTEX_FOR_SSH_KEYS = Mutex.new
def initialize(config)
@@ -37,7 +40,7 @@ module Kitchen
state[:ssh_key] = @config[:private_key]
state[:image_id] = build_image(state, dockerfile) unless state[:image_id]
state[:container_id] = run_container(state, 22) unless state[:container_id]
- state[:hostname] = 'localhost'
+ state[:hostname] = hostname(state)
state[:port] = container_ssh_port(state)
end
@@ -107,89 +110,11 @@ module Kitchen
return dockerfile_template if @config[:dockerfile]
from = "FROM #{@config[:image]}"
-
- platform = case @config[:platform]
- when 'debian', 'ubuntu'
- disable_upstart = <<-CODE
- RUN [ ! -f "/sbin/initctl" ] || dpkg-divert --local --rename --add /sbin/initctl && ln -sf /bin/true /sbin/initctl
- CODE
- packages = <<-CODE
- ENV DEBIAN_FRONTEND noninteractive
- ENV container docker
- RUN apt-get update
- RUN apt-get install -y sudo openssh-server curl lsb-release
- CODE
- @config[:disable_upstart] ? disable_upstart + packages : packages
- when 'rhel', 'centos', 'oraclelinux', 'amazonlinux'
- <<-CODE
- ENV container docker
- RUN yum clean all
- RUN yum install -y sudo openssh-server openssh-clients which curl
- RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
- RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
- CODE
- when 'fedora'
- <<-CODE
- ENV container docker
- RUN dnf clean all
- RUN dnf install -y sudo openssh-server openssh-clients which curl
- RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
- RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
- CODE
- when 'opensuse/tumbleweed', 'opensuse/leap', 'opensuse', 'sles'
- <<-CODE
- ENV container docker
- RUN zypper install -y sudo openssh which curl
- RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
- RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
- CODE
- when 'arch'
- # See https://bugs.archlinux.org/task/47052 for why we
- # blank out limits.conf.
- <<-CODE
- RUN pacman --noconfirm -Sy archlinux-keyring
- RUN pacman-db-upgrade
- RUN pacman --noconfirm -Syu openssl openssh sudo curl
- RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
- RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
- RUN echo >/etc/security/limits.conf
- CODE
- when 'gentoo'
- <<-CODE
- RUN emerge --sync
- RUN emerge net-misc/openssh app-admin/sudo
- RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
- RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
- CODE
- when 'gentoo-paludis'
- <<-CODE
- RUN cave sync
- RUN cave resolve -zx net-misc/openssh app-admin/sudo
- RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
- RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
- CODE
- else
- raise ActionFailed, "Unknown platform '#{@config[:platform]}'"
- end
-
+ platform = dockerfile_platform
username = @config[:username]
public_key = IO.read(@config[:public_key]).strip
homedir = username == 'root' ? '/root' : "/home/#{username}"
-
- base = <<-CODE
- RUN if ! getent passwd #{username}; then \
- useradd -d #{homedir} -m -s /bin/bash -p '*' #{username}; \
- fi
- RUN echo "#{username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
- RUN echo "Defaults !requiretty" >> /etc/sudoers
- RUN mkdir -p #{homedir}/.ssh
- RUN chown -R #{username} #{homedir}/.ssh
- RUN chmod 0700 #{homedir}/.ssh
- RUN touch #{homedir}/.ssh/authorized_keys
- RUN chown #{username} #{homedir}/.ssh/authorized_keys
- RUN chmod 0600 #{homedir}/.ssh/authorized_keys
- RUN mkdir -p /run/sshd
- CODE
+ base = dockerfile_base_linux(username, homedir)
custom = ''
Array(@config[:provision_command]).each do |cmd|
diff --git a/lib/kitchen/docker/container/windows.rb b/lib/kitchen/docker/container/windows.rb
index f5c3e5e..168dca7 100644
--- a/lib/kitchen/docker/container/windows.rb
+++ b/lib/kitchen/docker/container/windows.rb
@@ -30,6 +30,7 @@ module Kitchen
state[:username] = @config[:username]
state[:image_id] = build_image(state, dockerfile) unless state[:image_id]
state[:container_id] = run_container(state) unless state[:container_id]
+ state[:hostname] = hostname(state)
end
def execute(command)
diff --git a/lib/kitchen/docker/docker_version.rb b/lib/kitchen/docker/docker_version.rb
index 8d788f1..e3b7743 100644
--- a/lib/kitchen/docker/docker_version.rb
+++ b/lib/kitchen/docker/docker_version.rb
@@ -16,6 +16,6 @@
module Kitchen
module Docker
# Version string for Docker Kitchen driver
- DOCKER_VERSION = "2.10.0"
+ DOCKER_VERSION = "2.13.0"
end
end
diff --git a/lib/kitchen/docker/helpers/cli_helper.rb b/lib/kitchen/docker/helpers/cli_helper.rb
index a435614..1da52bb 100644
--- a/lib/kitchen/docker/helpers/cli_helper.rb
+++ b/lib/kitchen/docker/helpers/cli_helper.rb
@@ -36,6 +36,26 @@ module Kitchen
run_command("#{docker} #{cmd}", docker_shell_opts(options))
end
+ # Copied from kitchen because we need stderr
+ def run_command(cmd, options = {})
+ if options.fetch(:use_sudo, false)
+ cmd = "#{options.fetch(:sudo_command, "sudo -E")} #{cmd}"
+ end
+ subject = "[#{options.fetch(:log_subject, "local")} command]"
+
+ debug("#{subject} BEGIN (#{cmd})")
+ sh = Mixlib::ShellOut.new(cmd, shell_opts(options))
+ sh.run_command
+ debug("#{subject} END #{Util.duration(sh.execution_time)}")
+ sh.error!
+ sh.stdout + sh.stderr
+ rescue Mixlib::ShellOut::ShellCommandFailed => ex
+ raise ShellCommandFailed, ex.message
+ rescue Exception => error # rubocop:disable Lint/RescueException
+ error.extend(Kitchen::Error)
+ raise
+ end
+
def build_run_command(image_id, transport_port = nil)
cmd = 'run -d'
cmd << ' -i' if config[:interactive]
@@ -49,17 +69,22 @@ module Kitchen
Array(config[:volumes_from]).each { |container| cmd << " --volumes-from #{container}" }
Array(config[:links]).each { |link| cmd << " --link #{link}" }
Array(config[:devices]).each { |device| cmd << " --device #{device}" }
+ Array(config[:mount]).each {|mount| cmd << " --mount #{mount}"}
+ Array(config[:tmpfs]).each {|tmpfs| cmd << " --tmpfs #{tmpfs}"}
cmd << " --name #{config[:instance_name]}" if config[:instance_name]
cmd << ' -P' if config[:publish_all]
cmd << " -h #{config[:hostname]}" if config[:hostname]
cmd << " -m #{config[:memory]}" if config[:memory]
cmd << " -c #{config[:cpu]}" if config[:cpu]
+ cmd << " --gpus #{config[:gpus]}" if config[:gpus]
cmd << " -e http_proxy=#{config[:http_proxy]}" if config[:http_proxy]
cmd << " -e https_proxy=#{config[:https_proxy]}" if config[:https_proxy]
cmd << ' --privileged' if config[:privileged]
+ cmd << " --isolation #{config[:isolation]}" if config[:isolation]
Array(config[:cap_add]).each { |cap| cmd << " --cap-add=#{cap}"} if config[:cap_add]
Array(config[:cap_drop]).each { |cap| cmd << " --cap-drop=#{cap}"} if config[:cap_drop]
Array(config[:security_opt]).each { |opt| cmd << " --security-opt=#{opt}"} if config[:security_opt]
+ cmd << " --platform=#{config[:docker_platform]}" if config[:docker_platform]
extra_run_options = config_to_options(config[:run_options])
cmd << " #{extra_run_options}" unless extra_run_options.empty?
cmd << " #{image_id} #{config[:run_command]}"
diff --git a/lib/kitchen/docker/helpers/dockerfile_helper.rb b/lib/kitchen/docker/helpers/dockerfile_helper.rb
new file mode 100644
index 0000000..d55f19f
--- /dev/null
+++ b/lib/kitchen/docker/helpers/dockerfile_helper.rb
@@ -0,0 +1,160 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require 'kitchen'
+require 'kitchen/configurable'
+
+module Kitchen
+ module Docker
+ module Helpers
+ module DockerfileHelper
+ include Configurable
+
+ def dockerfile_platform
+ case config[:platform]
+ when 'arch'
+ arch_platform
+ when 'debian', 'ubuntu'
+ debian_platform
+ when 'fedora'
+ fedora_platform
+ when 'gentoo'
+ gentoo_platform
+ when 'gentoo-paludis'
+ gentoo_paludis_platform
+ when 'opensuse/tumbleweed', 'opensuse/leap', 'opensuse', 'sles'
+ opensuse_platform
+ when 'rhel', 'centos', 'oraclelinux', 'amazonlinux', 'almalinux', 'rockylinux'
+ rhel_platform
+ when 'centosstream'
+ centosstream_platform
+ when 'photon'
+ photonos_platform
+ else
+ raise ActionFailed, "Unknown platform '#{config[:platform]}'"
+ end
+ end
+
+ def arch_platform
+ # See https://bugs.archlinux.org/task/47052 for why we
+ # blank out limits.conf.
+ <<-CODE
+ RUN pacman --noconfirm -Sy archlinux-keyring
+ RUN pacman-db-upgrade
+ RUN pacman --noconfirm -Syu openssl openssh sudo curl
+ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
+ RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
+ RUN echo >/etc/security/limits.conf
+ CODE
+ end
+
+ def debian_platform
+ disable_upstart = <<-CODE
+ RUN [ ! -f "/sbin/initctl" ] || dpkg-divert --local --rename --add /sbin/initctl \
+ && ln -sf /bin/true /sbin/initctl
+ CODE
+ packages = <<-CODE
+ ENV DEBIAN_FRONTEND noninteractive
+ ENV container docker
+ RUN apt-get update
+ RUN apt-get install -y sudo openssh-server curl lsb-release
+ CODE
+ config[:disable_upstart] ? disable_upstart + packages : packages
+ end
+
+ def fedora_platform
+ <<-CODE
+ ENV container docker
+ RUN dnf clean all
+ RUN dnf install -y sudo openssh-server openssh-clients which curl
+ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
+ RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
+ CODE
+ end
+
+ def gentoo_platform
+ <<-CODE
+ RUN emerge-webrsync
+ RUN emerge --quiet --noreplace net-misc/openssh app-admin/sudo
+ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
+ RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
+ CODE
+ end
+
+ def gentoo_paludis_platform
+ <<-CODE
+ RUN cave sync
+ RUN cave resolve -zx net-misc/openssh app-admin/sudo
+ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -A -t rsa -f /etc/ssh/ssh_host_rsa_key
+ RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -A -t dsa -f /etc/ssh/ssh_host_dsa_key
+ CODE
+ end
+
+ def opensuse_platform
+ <<-CODE
+ ENV container docker
+ RUN zypper install -y sudo openssh which curl
+ RUN /usr/sbin/sshd-gen-keys-start
+ CODE
+ end
+
+ def rhel_platform
+ <<-CODE
+ ENV container docker
+ RUN yum clean all
+ RUN yum install -y sudo openssh-server openssh-clients which curl
+ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
+ RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
+ CODE
+ end
+
+ def centosstream_platform
+ <<-CODE
+ ENV container docker
+ RUN yum clean all
+ RUN yum install -y sudo openssh-server openssh-clients which
+ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
+ RUN [ -f "/etc/ssh/ssh_host_dsa_key" ] || ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
+ CODE
+ end
+
+ def photonos_platform
+ <<-CODE
+ ENV container docker
+ RUN tdnf clean all
+ RUN tdnf install -y sudo openssh-server openssh-clients which curl
+ RUN [ -f "/etc/ssh/ssh_host_ecdsa_key" ] || ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''
+ RUN [ -f "/etc/ssh/ssh_host_ed25519_key" ] || ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ''
+ CODE
+ end
+
+ def dockerfile_base_linux(username, homedir)
+ <<-CODE
+ RUN if ! getent passwd #{username}; then \
+ useradd -d #{homedir} -m -s /bin/bash -p '*' #{username}; \
+ fi
+ RUN echo "#{username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/#{username}
+ RUN echo "Defaults !requiretty" >> /etc/sudoers.d/#{username}
+ RUN mkdir -p #{homedir}/.ssh
+ RUN chown -R #{username} #{homedir}/.ssh
+ RUN chmod 0700 #{homedir}/.ssh
+ RUN touch #{homedir}/.ssh/authorized_keys
+ RUN chown #{username} #{homedir}/.ssh/authorized_keys
+ RUN chmod 0600 #{homedir}/.ssh/authorized_keys
+ RUN mkdir -p /run/sshd
+ CODE
+ end
+ end
+ end
+ end
+end
diff --git a/lib/kitchen/docker/helpers/image_helper.rb b/lib/kitchen/docker/helpers/image_helper.rb
index 992bd98..4d21a0e 100644
--- a/lib/kitchen/docker/helpers/image_helper.rb
+++ b/lib/kitchen/docker/helpers/image_helper.rb
@@ -26,8 +26,13 @@ module Kitchen
def parse_image_id(output)
output.each_line do |line|
+ if line =~ /writing image (sha256:[[:xdigit:]]{64})(?: \d*\.\ds)? done/i
+ img_id = line[/writing image (sha256:[[:xdigit:]]{64})(?: \d*\.\ds)? done/i,1]
+ return img_id
+ end
if line =~ /image id|build successful|successfully built/i
- return line.split(/\s+/).last
+ img_id = line.split(/\s+/).last
+ return img_id
end
end
raise ActionFailed, 'Could not parse Docker build output for image ID'
@@ -41,16 +46,19 @@ module Kitchen
def build_image(state, dockerfile)
cmd = 'build'
cmd << ' --no-cache' unless config[:use_cache]
+ cmd << " --platform=#{config[:docker_platform]}" if config[:docker_platform]
extra_build_options = config_to_options(config[:build_options])
cmd << " #{extra_build_options}" unless extra_build_options.empty?
dockerfile_contents = dockerfile
- build_context = config[:build_context] ? '.' : '-'
file = Tempfile.new('Dockerfile-kitchen', Dir.pwd)
+ cmd << " -f #{Shellwords.escape(dockerfile_path(file))}" if config[:build_context]
+ build_context = config[:build_context] ? '.' : '-'
output = begin
file.write(dockerfile)
file.close
- docker_command("#{cmd} -f #{Shellwords.escape(dockerfile_path(file))} #{build_context}",
- input: dockerfile_contents)
+ docker_command("#{cmd} #{build_context}",
+ input: dockerfile_contents,
+ environment: { BUILDKIT_PROGRESS: 'plain' })
ensure
file.close unless file.closed?
file.unlink
diff --git a/lib/kitchen/driver/docker.rb b/lib/kitchen/driver/docker.rb
index 7708da7..65e800b 100644
--- a/lib/kitchen/driver/docker.rb
+++ b/lib/kitchen/driver/docker.rb
@@ -1,164 +1,165 @@
-#
-# Copyright (C) 2014, Sean Porter
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-require 'kitchen'
-require 'json'
-require 'securerandom'
-require 'net/ssh'
-
-require 'kitchen/driver/base'
-
-require_relative '../docker/container/linux'
-require_relative '../docker/container/windows'
-require_relative '../docker/helpers/cli_helper'
-require_relative '../docker/helpers/container_helper'
-
-module Kitchen
- module Driver
- # Docker driver for Kitchen.
- #
- # @author Sean Porter <portertech@gmail.com>
- class Docker < Kitchen::Driver::Base
- include Kitchen::Docker::Helpers::CliHelper
- include Kitchen::Docker::Helpers::ContainerHelper
- include ShellOut
-
- default_config :binary, 'docker'
- default_config :build_options, nil
- default_config :cap_add, nil
- default_config :cap_drop, nil
- default_config :disable_upstart, true
- default_config :env_variables, nil
- default_config :interactive, false
- default_config :private_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa')
- default_config :privileged, false
- default_config :public_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa.pub')
- default_config :publish_all, false
- default_config :remove_images, false
- default_config :run_options, nil
- default_config :security_opt, nil
- default_config :tls, false
- default_config :tls_cacert, nil
- default_config :tls_cert, nil
- default_config :tls_key, nil
- default_config :tls_verify, false
- default_config :tty, false
- default_config :use_cache, true
- default_config :use_internal_docker_network, false
- default_config :use_sudo, false
- default_config :wait_for_transport, true
-
- default_config :build_context do |driver|
- !driver.remote_socket?
- end
-
- default_config :image do |driver|
- driver.default_image
- end
-
- default_config :instance_name do |driver|
- # Borrowed from kitchen-rackspace
- [
- driver.instance.name.gsub(/\W/, ''),
- (Etc.getlogin || 'nologin').gsub(/\W/, ''),
- Socket.gethostname.gsub(/\W/, '')[0..20],
- Array.new(8) { rand(36).to_s(36) }.join
- ].join('-')
- end
-
- default_config :platform do |driver|
- driver.default_platform
- end
-
- default_config :run_command do |driver|
- if driver.windows_os?
- # Launch arbitrary process to keep the Windows container alive
- # If running in interactive mode, launch powershell.exe instead
- if driver[:interactive]
- 'powershell.exe'
- else
- 'ping -t localhost'
- end
- else
- '/usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no -o PasswordAuthentication=yes '\
- '-o UsePrivilegeSeparation=no -o PidFile=/tmp/sshd.pid'
- end
- end
-
- default_config :socket do |driver|
- socket = 'unix:///var/run/docker.sock'
- socket = 'npipe:////./pipe/docker_engine' if driver.windows_os?
- ENV['DOCKER_HOST'] || socket
- end
-
- default_config :username do |driver|
- # Return nil to prevent username from being added to Docker
- # command line args for Windows if a username was not specified
- if driver.windows_os?
- nil
- else
- 'kitchen'
- end
- end
-
- def verify_dependencies
- run_command("#{config[:binary]} >> #{dev_null} 2>&1", quiet: true, use_sudo: config[:use_sudo])
- rescue
- raise UserError, 'You must first install the Docker CLI tool https://www.docker.com/get-started'
- end
-
- def create(state)
- container.create(state)
-
- wait_for_transport(state)
- end
-
- def destroy(state)
- container.destroy(state)
- end
-
- def wait_for_transport(state)
- if config[:wait_for_transport]
- instance.transport.connection(state) do |conn|
- conn.wait_until_ready
- end
- end
- end
-
- def default_image
- platform, release = instance.platform.name.split('-')
- if platform == 'centos' && release
- release = 'centos' + release.split('.').first
- end
- release ? [platform, release].join(':') : platform
- end
-
- def default_platform
- instance.platform.name.split('-').first
- end
-
- protected
-
- def container
- @container ||= if windows_os?
- Kitchen::Docker::Container::Windows.new(config)
- else
- Kitchen::Docker::Container::Linux.new(config)
- end
- @container
- end
- end
- end
-end
+#
+# Copyright (C) 2014, Sean Porter
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require 'kitchen'
+require 'json'
+require 'securerandom'
+require 'net/ssh'
+
+require 'kitchen/driver/base'
+
+require_relative '../docker/container/linux'
+require_relative '../docker/container/windows'
+require_relative '../docker/helpers/cli_helper'
+require_relative '../docker/helpers/container_helper'
+
+module Kitchen
+ module Driver
+ # Docker driver for Kitchen.
+ #
+ # @author Sean Porter <portertech@gmail.com>
+ class Docker < Kitchen::Driver::Base
+ include Kitchen::Docker::Helpers::CliHelper
+ include Kitchen::Docker::Helpers::ContainerHelper
+ include ShellOut
+
+ default_config :binary, 'docker'
+ default_config :build_options, nil
+ default_config :cap_add, nil
+ default_config :cap_drop, nil
+ default_config :disable_upstart, true
+ default_config :env_variables, nil
+ default_config :isolation, nil
+ default_config :interactive, false
+ default_config :private_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa')
+ default_config :privileged, false
+ default_config :public_key, File.join(Dir.pwd, '.kitchen', 'docker_id_rsa.pub')
+ default_config :publish_all, false
+ default_config :remove_images, false
+ default_config :run_options, nil
+ default_config :security_opt, nil
+ default_config :tls, false
+ default_config :tls_cacert, nil
+ default_config :tls_cert, nil
+ default_config :tls_key, nil
+ default_config :tls_verify, false
+ default_config :tty, false
+ default_config :use_cache, true
+ default_config :use_internal_docker_network, false
+ default_config :use_sudo, false
+ default_config :wait_for_transport, true
+
+ default_config :build_context do |driver|
+ !driver.remote_socket?
+ end
+
+ default_config :image do |driver|
+ driver.default_image
+ end
+
+ default_config :instance_name do |driver|
+ # Borrowed from kitchen-rackspace
+ [
+ driver.instance.name.gsub(/\W/, ''),
+ (Etc.getlogin || 'nologin').gsub(/\W/, ''),
+ Socket.gethostname.gsub(/\W/, '')[0..20],
+ Array.new(8) { rand(36).to_s(36) }.join
+ ].join('-').downcase
+ end
+
+ default_config :platform do |driver|
+ driver.default_platform
+ end
+
+ default_config :run_command do |driver|
+ if driver.windows_os?
+ # Launch arbitrary process to keep the Windows container alive
+ # If running in interactive mode, launch powershell.exe instead
+ if driver[:interactive]
+ 'powershell.exe'
+ else
+ 'ping -t localhost'
+ end
+ else
+ '/usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no -o PasswordAuthentication=yes '\
+ '-o UsePrivilegeSeparation=no -o PidFile=/tmp/sshd.pid'
+ end
+ end
+
+ default_config :socket do |driver|
+ socket = 'unix:///var/run/docker.sock'
+ socket = 'npipe:////./pipe/docker_engine' if driver.windows_os?
+ ENV['DOCKER_HOST'] || socket
+ end
+
+ default_config :username do |driver|
+ # Return nil to prevent username from being added to Docker
+ # command line args for Windows if a username was not specified
+ if driver.windows_os?
+ nil
+ else
+ 'kitchen'
+ end
+ end
+
+ def verify_dependencies
+ run_command("#{config[:binary]} >> #{dev_null} 2>&1", quiet: true, use_sudo: config[:use_sudo])
+ rescue
+ raise UserError, 'You must first install the Docker CLI tool https://www.docker.com/get-started'
+ end
+
+ def create(state)
+ container.create(state)
+
+ wait_for_transport(state)
+ end
+
+ def destroy(state)
+ container.destroy(state)
+ end
+
+ def wait_for_transport(state)
+ if config[:wait_for_transport]
+ instance.transport.connection(state) do |conn|
+ conn.wait_until_ready
+ end
+ end
+ end
+
+ def default_image
+ platform, release = instance.platform.name.split('-')
+ if platform == 'centos' && release
+ release = 'centos' + release.split('.').first
+ end
+ release ? [platform, release].join(':') : platform
+ end
+
+ def default_platform
+ instance.platform.name.split('-').first
+ end
+
+ protected
+
+ def container
+ @container ||= if windows_os?
+ Kitchen::Docker::Container::Windows.new(config)
+ else
+ Kitchen::Docker::Container::Linux.new(config)
+ end
+ @container
+ end
+ end
+ end
+end
diff --git a/test/Dockerfile b/test/Dockerfile
index 97286ac..4ecf596 100644
--- a/test/Dockerfile
+++ b/test/Dockerfile
@@ -1,4 +1,4 @@
-FROM centos:6
+FROM centos:7
RUN yum clean all
RUN yum install -y sudo openssh-server openssh-clients which curl htop
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/docker/version.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/container.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/container/linux.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/container/windows.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/docker_version.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/erb_context.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/helpers/cli_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/helpers/container_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/helpers/dockerfile_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/helpers/file_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/helpers/image_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/docker/helpers/inspec_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/driver/docker.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/kitchen/transport/docker.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.13.0/lib/train/docker.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/specifications/kitchen-docker-2.13.0.gemspec
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/docker/version.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/container.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/container/linux.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/container/windows.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/docker_version.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/erb_context.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/helpers/cli_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/helpers/container_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/helpers/file_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/helpers/image_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/docker/helpers/inspec_helper.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/driver/docker.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/kitchen/transport/docker.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/gems/kitchen-docker-2.10.0/lib/train/docker.rb -rw-r--r-- root/root /usr/share/rubygems-integration/all/specifications/kitchen-docker-2.10.0.gemspec
No differences were encountered in the control files