kitchen-docker 3.2.4 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.release-please-manifest.json +1 -1
- data/.rubocop.yml +0 -1
- data/.yardopts +11 -0
- data/CHANGELOG.md +385 -18
- data/CONTRIBUTING.md +203 -0
- data/Gemfile +5 -3
- data/README.md +418 -519
- data/Rakefile +18 -0
- data/kitchen-docker.gemspec +3 -2
- data/lib/kitchen/docker/container/linux.rb +50 -0
- data/lib/kitchen/docker/container/windows.rb +27 -0
- data/lib/kitchen/docker/container.rb +34 -0
- data/lib/kitchen/docker/docker_version.rb +4 -2
- data/lib/kitchen/docker/erb_context.rb +9 -0
- data/lib/kitchen/docker/helpers/cli_helper.rb +56 -3
- data/lib/kitchen/docker/helpers/container_helper.rb +91 -19
- data/lib/kitchen/docker/helpers/dockerfile_helper.rb +54 -0
- data/lib/kitchen/docker/helpers/file_helper.rb +8 -0
- data/lib/kitchen/docker/helpers/image_helper.rb +28 -0
- data/lib/kitchen/docker/helpers/inspec_helper.rb +1 -0
- data/lib/kitchen/driver/docker.rb +27 -0
- data/lib/kitchen/transport/docker.rb +92 -2
- data/spec/cli_helper_spec.rb +312 -0
- data/spec/container_helper_spec.rb +178 -0
- data/spec/dockerfile_helper_spec.rb +97 -61
- data/spec/erb_context_spec.rb +60 -0
- data/spec/image_helper_spec.rb +142 -0
- data/spec/inspec_helper_spec.rb +14 -11
- data/spec/linux_container_spec.rb +194 -0
- data/spec/spec_helper.rb +28 -1
- data/spec/support/argv.rb +55 -0
- data/spec/support/docker_output.rb +117 -0
- data/spec/support/harness.rb +70 -0
- data/spec/transport_docker_spec.rb +130 -0
- data/spec/windows_container_spec.rb +101 -0
- metadata +16 -7
- data/test/integration/capabilities/disabled/capabilities_drop_spec.rb +0 -24
- data/test/integration/default/disabled/default_spec.rb +0 -24
- data/test/integration/default/disabled/spec_helper.rb +0 -21
data/README.md
CHANGED
|
@@ -1,672 +1,571 @@
|
|
|
1
|
-
#
|
|
1
|
+
# kitchen-docker
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/test-kitchen/kitchen-docker)
|
|
4
3
|
[](https://rubygems.org/gems/kitchen-docker)
|
|
5
|
-
[](https://codecov.io/github/test-kitchen/kitchen-docker)
|
|
6
4
|
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
7
5
|
|
|
8
|
-
A Test Kitchen
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
A [Test Kitchen][test_kitchen_docs] **driver** and **transport** for Docker.
|
|
7
|
+
|
|
8
|
+
The driver builds an image for each platform and runs a container from it. The
|
|
9
|
+
transport runs your commands inside that container with `docker exec`, so no
|
|
10
|
+
SSH or WinRM server is needed. Together they let you converge and verify a
|
|
11
|
+
cookbook against a dozen distributions in about the time it takes one virtual
|
|
12
|
+
machine to boot.
|
|
13
|
+
|
|
14
|
+
> **Maintainers wanted.** This driver is currently without a maintainer and has
|
|
15
|
+
> known issues. If you would like to take it on — including expanding the CI
|
|
16
|
+
> coverage — please reach out in
|
|
17
|
+
> [#test-kitchen on Chef Community Slack](https://chefcommunity.slack.com/archives/C2B6G1WCQ).
|
|
18
|
+
> Until then, we recommend [kitchen-dokken][dokken] for Chef Infra testing with
|
|
19
|
+
> Docker containers.
|
|
20
|
+
|
|
21
|
+
## Contents
|
|
22
|
+
|
|
23
|
+
* [Requirements](#requirements)
|
|
24
|
+
* [Installation](#installation)
|
|
25
|
+
* [Quick start](#quick-start)
|
|
26
|
+
* [How it works](#how-it-works)
|
|
27
|
+
* [Choosing an image and platform](#choosing-an-image-and-platform)
|
|
28
|
+
* [Driver configuration](#driver-configuration)
|
|
29
|
+
* [Transport configuration](#transport-configuration)
|
|
30
|
+
* [Logging into a container](#logging-into-a-container)
|
|
31
|
+
* [Examples](#examples)
|
|
32
|
+
* [Using with Chef](#using-with-chef)
|
|
33
|
+
* [Troubleshooting](#troubleshooting)
|
|
34
|
+
* [Contributing](#contributing)
|
|
35
|
+
* [License](#license)
|
|
11
36
|
|
|
12
37
|
## Requirements
|
|
13
38
|
|
|
14
|
-
* [Docker][docker_installation]
|
|
39
|
+
* [Docker][docker_installation] 1.5 or newer, running locally or reachable over
|
|
40
|
+
the network.
|
|
41
|
+
* Ruby 3.1 or newer.
|
|
15
42
|
|
|
16
|
-
## Installation
|
|
43
|
+
## Installation
|
|
17
44
|
|
|
18
|
-
|
|
45
|
+
This driver ships as part of [Cinc Workstation][cinc_workstation] and
|
|
46
|
+
[Chef Workstation][chef_workstation]. If you have either installed, there is
|
|
47
|
+
nothing else to do.
|
|
19
48
|
|
|
20
|
-
|
|
49
|
+
To install it into a standalone Ruby:
|
|
21
50
|
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
name: docker
|
|
26
|
-
env_variables:
|
|
27
|
-
TEST_KEY: TEST_VALUE
|
|
51
|
+
```sh
|
|
52
|
+
gem install kitchen-docker
|
|
53
|
+
```
|
|
28
54
|
|
|
29
|
-
|
|
30
|
-
- name: ubuntu
|
|
31
|
-
run_list:
|
|
32
|
-
- recipe[apt]
|
|
33
|
-
- name: centos
|
|
34
|
-
driver_config:
|
|
35
|
-
image: centos
|
|
36
|
-
platform: rhel
|
|
37
|
-
run_list:
|
|
38
|
-
- recipe[yum]
|
|
55
|
+
Or add it to your cookbook's `Gemfile`:
|
|
39
56
|
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
```ruby
|
|
58
|
+
gem "kitchen-docker"
|
|
42
59
|
```
|
|
43
60
|
|
|
44
|
-
|
|
61
|
+
## Quick start
|
|
62
|
+
|
|
63
|
+
Create a `kitchen.yml` in your cookbook:
|
|
45
64
|
|
|
46
65
|
```yaml
|
|
47
66
|
---
|
|
48
67
|
driver:
|
|
49
68
|
name: docker
|
|
50
69
|
|
|
51
|
-
platforms:
|
|
52
|
-
- name: windows
|
|
53
|
-
driver_config:
|
|
54
|
-
image: mcr.microsoft.com/windows/servercore:1607
|
|
55
|
-
platform: windows
|
|
56
|
-
run_list:
|
|
57
|
-
- recipe[chef_client]
|
|
58
|
-
|
|
59
70
|
transport:
|
|
60
71
|
name: docker
|
|
61
|
-
env_variables:
|
|
62
|
-
TEST_KEY: TEST_VALUE
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Default Configuration
|
|
66
72
|
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
provisioner:
|
|
74
|
+
name: cinc_infra
|
|
69
75
|
|
|
70
|
-
|
|
76
|
+
verifier:
|
|
77
|
+
name: cinc_auditor
|
|
71
78
|
|
|
72
|
-
```yaml
|
|
73
|
-
---
|
|
74
79
|
platforms:
|
|
75
|
-
- name: ubuntu-
|
|
76
|
-
- name:
|
|
77
|
-
```
|
|
80
|
+
- name: ubuntu-24.04
|
|
81
|
+
- name: almalinux-9
|
|
78
82
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
platforms:
|
|
84
|
-
- name: ubuntu-18.04
|
|
85
|
-
driver_config:
|
|
86
|
-
image: ubuntu:18.04
|
|
87
|
-
platform: ubuntu
|
|
88
|
-
- name: centos-7
|
|
89
|
-
driver_config:
|
|
90
|
-
image: centos:7
|
|
91
|
-
platform: centos
|
|
83
|
+
suites:
|
|
84
|
+
- name: default
|
|
85
|
+
run_list:
|
|
86
|
+
- recipe[my_cookbook::default]
|
|
92
87
|
```
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### binary
|
|
89
|
+
That is a complete configuration — no `image`, no `platform`, no
|
|
90
|
+
`run_command`. The driver derives them from each platform name.
|
|
97
91
|
|
|
98
|
-
|
|
92
|
+
Run it:
|
|
99
93
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Examples:
|
|
103
|
-
|
|
104
|
-
```yaml
|
|
105
|
-
binary: docker.io
|
|
94
|
+
```sh
|
|
95
|
+
kitchen test
|
|
106
96
|
```
|
|
107
97
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### socket
|
|
113
|
-
|
|
114
|
-
The Docker daemon socket to use. By default, Docker will listen on `unix:///var/run/docker.sock` (On Windows, `npipe:////./pipe/docker_engine`),
|
|
115
|
-
and no configuration here is required. If Docker is binding to another host/port or Unix socket, you will need to set this option.
|
|
116
|
-
If a TCP socket is set, its host will be used for SSH access to suite containers.
|
|
98
|
+
Test Kitchen will, for each platform, build an image, start a container,
|
|
99
|
+
converge your cookbook, run the verifier, and destroy the container. To work
|
|
100
|
+
interactively instead:
|
|
117
101
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
```yaml
|
|
125
|
-
socket: tcp://docker.example.com:4242
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
If you are using the InSpec verifier on Windows, using named pipes for the Docker engine will not work with the Docker transport.
|
|
129
|
-
Set the socket option with the TCP socket address of the Docker engine as shown below:
|
|
130
|
-
|
|
131
|
-
```yaml
|
|
132
|
-
socket: tcp://localhost:2375
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
The Docker engine must be configured to listen on a TCP port (default port is 2375). This can be configured by editing the configuration file
|
|
136
|
-
(usually located in `C:\ProgramData\docker\config\daemon.json`) and adding the hosts value:
|
|
137
|
-
|
|
138
|
-
```json
|
|
139
|
-
"hosts": ["tcp://0.0.0.0:2375"]
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Example configuration is shown below:
|
|
143
|
-
|
|
144
|
-
```json
|
|
145
|
-
{
|
|
146
|
-
"registry-mirrors": [],
|
|
147
|
-
"insecure-registries": [],
|
|
148
|
-
"debug": true,
|
|
149
|
-
"experimental": false,
|
|
150
|
-
"hosts": ["tcp://0.0.0.0:2375"]
|
|
151
|
-
}
|
|
102
|
+
```sh
|
|
103
|
+
kitchen converge default-ubuntu-2404 # build, start, and converge
|
|
104
|
+
kitchen login default-ubuntu-2404 # get a shell inside the container
|
|
105
|
+
kitchen verify default-ubuntu-2404 # run the tests
|
|
106
|
+
kitchen destroy default-ubuntu-2404 # clean up
|
|
152
107
|
```
|
|
153
108
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
DOCKER_HOST=tcp://192.168.59.103:2375` or `eval "$(docker-machine env
|
|
158
|
-
$MACHINE)"` then use the following:
|
|
159
|
-
|
|
160
|
-
```yaml
|
|
161
|
-
socket: tcp://192.168.59.103:2375
|
|
162
|
-
```
|
|
109
|
+
The examples above use the `cinc_infra` provisioner and `cinc_auditor`
|
|
110
|
+
verifier. If you use Chef Workstation, substitute `chef_infra` and `inspec` —
|
|
111
|
+
see [Using with Chef](#using-with-chef). No driver changes are needed.
|
|
163
112
|
|
|
164
|
-
|
|
113
|
+
## How it works
|
|
165
114
|
|
|
166
|
-
|
|
167
|
-
|
|
115
|
+
Knowing the sequence makes the configuration options below much easier to
|
|
116
|
+
place:
|
|
168
117
|
|
|
169
|
-
|
|
170
|
-
|
|
118
|
+
1. **Generate a Dockerfile.** The driver writes one based on `image` and
|
|
119
|
+
`platform`: it installs an SSH server and `sudo`, creates the `username`
|
|
120
|
+
account, and authorises the generated `public_key`. Anything in
|
|
121
|
+
`provision_command` is appended. Supply your own with
|
|
122
|
+
[`dockerfile`](#images-and-building) to skip all of this.
|
|
123
|
+
2. **Build the image**, sending `build_context` (your cookbook directory) to
|
|
124
|
+
the daemon if the daemon needs it.
|
|
125
|
+
3. **Run a container** from the image with `run_command` as PID 1 — by default
|
|
126
|
+
`sshd`, which keeps the container alive and gives Test Kitchen something to
|
|
127
|
+
connect to.
|
|
128
|
+
4. **Run commands in it.** With `transport: docker` this is `docker exec`. With
|
|
129
|
+
the default SSH transport, it is SSH to the forwarded port using the
|
|
130
|
+
generated key.
|
|
171
131
|
|
|
172
|
-
|
|
132
|
+
Because the image is rebuilt from a Dockerfile, most driver options are
|
|
133
|
+
*image*-level (`build_options`, `provision_command`) or *container*-level
|
|
134
|
+
(`volume`, `privileged`, `forward`). The tables below are grouped that way.
|
|
173
135
|
|
|
174
|
-
|
|
136
|
+
## Choosing an image and platform
|
|
175
137
|
|
|
176
|
-
For
|
|
138
|
+
For most platforms, the name is all you need. The driver splits it on the first
|
|
139
|
+
`-` into an image and a platform family:
|
|
177
140
|
|
|
178
141
|
```yaml
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
#
|
|
183
|
-
isolation: process
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### platform
|
|
187
|
-
|
|
188
|
-
The platform of the chosen image. This is used to properly bootstrap the
|
|
189
|
-
suite container for Test Kitchen. Kitchen Docker currently supports:
|
|
190
|
-
|
|
191
|
-
* `arch`
|
|
192
|
-
* `debian` or `ubuntu`
|
|
193
|
-
* `amazonlinux`, `rhel`, `centos`, `fedora`, `oraclelinux`, `almalinux` or `rockylinux`
|
|
194
|
-
* `gentoo` or `gentoo-paludis`
|
|
195
|
-
* `opensuse/tumbleweed`, `opensuse/leap`, `opensuse` or `sles`
|
|
196
|
-
* `windows`
|
|
197
|
-
|
|
198
|
-
The default will be computed, using the platform name (see the Default
|
|
199
|
-
Configuration section for more details).
|
|
200
|
-
|
|
201
|
-
### require\_chef\_omnibus
|
|
202
|
-
|
|
203
|
-
Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
|
|
204
|
-
installed. There are several different behaviors available:
|
|
205
|
-
|
|
206
|
-
* `true` - the latest release will be installed. Subsequent converges
|
|
207
|
-
will skip re-installing if chef is present.
|
|
208
|
-
* `latest` - the latest release will be installed. Subsequent converges
|
|
209
|
-
will always re-install even if chef is present.
|
|
210
|
-
* `<VERSION_STRING>` (ex: `10.24.0`) - the desired version string will
|
|
211
|
-
be passed the the install.sh script. Subsequent converges will skip if
|
|
212
|
-
the installed version and the desired version match.
|
|
213
|
-
* `false` or `nil` - no chef is installed.
|
|
214
|
-
|
|
215
|
-
The default value is `true`.
|
|
216
|
-
|
|
217
|
-
### disable\_upstart
|
|
218
|
-
|
|
219
|
-
Disables upstart on Debian/Ubuntu containers, as many images do not support a
|
|
220
|
-
working upstart.
|
|
221
|
-
|
|
222
|
-
The default value is `true`.
|
|
223
|
-
|
|
224
|
-
### provision\_command
|
|
225
|
-
|
|
226
|
-
Custom command(s) to be run when provisioning the base for the suite containers.
|
|
227
|
-
|
|
228
|
-
Examples:
|
|
229
|
-
|
|
230
|
-
```yaml
|
|
231
|
-
provision_command: curl -L https://www.opscode.com/chef/install.sh | bash
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
```yaml
|
|
235
|
-
provision_command:
|
|
236
|
-
- apt-get install dnsutils
|
|
237
|
-
- apt-get install telnet
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
```yaml
|
|
241
|
-
driver_config:
|
|
242
|
-
provision_command: curl -L https://www.opscode.com/chef/install.sh | bash
|
|
243
|
-
require_chef_omnibus: false
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### env_variables
|
|
247
|
-
|
|
248
|
-
Adds environment variables to Docker container
|
|
249
|
-
|
|
250
|
-
Examples:
|
|
251
|
-
|
|
252
|
-
```yaml
|
|
253
|
-
env_variables:
|
|
254
|
-
TEST_KEY_1: TEST_VALUE
|
|
255
|
-
SOME_VAR: SOME_VALUE
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### use\_cache
|
|
259
|
-
|
|
260
|
-
This determines if the Docker cache is used when provisioning the base for suite
|
|
261
|
-
containers.
|
|
262
|
-
|
|
263
|
-
The default value is `true`.
|
|
264
|
-
|
|
265
|
-
### use\_sudo
|
|
266
|
-
|
|
267
|
-
This determines if Docker commands are run with `sudo`.
|
|
268
|
-
|
|
269
|
-
The default value depends on the type of socket being used. For local sockets, the default value is `true`. For remote sockets, the default value is `false`.
|
|
270
|
-
|
|
271
|
-
This should be set to `false` if you're using boot2docker, as every command passed into the VM runs as root by default.
|
|
272
|
-
|
|
273
|
-
### remove\_images
|
|
274
|
-
|
|
275
|
-
This determines if images are automatically removed when the suite container is
|
|
276
|
-
destroyed.
|
|
277
|
-
|
|
278
|
-
The default value is `false`.
|
|
279
|
-
|
|
280
|
-
### run\_command
|
|
281
|
-
|
|
282
|
-
Sets the command used to run the suite container.
|
|
283
|
-
|
|
284
|
-
The default value is `/usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no -o PasswordAuthentication=yes -o UsePrivilegeSeparation=no -o PidFile=/tmp/sshd.pid`.
|
|
285
|
-
|
|
286
|
-
Examples:
|
|
287
|
-
|
|
288
|
-
```yaml
|
|
289
|
-
run_command: /sbin/init
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### memory
|
|
293
|
-
|
|
294
|
-
Sets the memory limit for the suite container in bytes. Otherwise use Dockers
|
|
295
|
-
default. You can read more about `memory.limit_in_bytes` in the [Resource Management Guide][memory_limit].
|
|
296
|
-
|
|
297
|
-
### cpu
|
|
298
|
-
|
|
299
|
-
Sets the CPU shares (relative weight) for the suite container. Otherwise use
|
|
300
|
-
Dockers defaults. You can read more about cpu.shares in the [Resource Management Guide][cpu_shares].
|
|
301
|
-
|
|
302
|
-
### volume
|
|
303
|
-
|
|
304
|
-
Adds a data volume(s) to the suite container.
|
|
305
|
-
|
|
306
|
-
Examples:
|
|
307
|
-
|
|
308
|
-
```yaml
|
|
309
|
-
volume: /ftp
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
```yaml
|
|
313
|
-
volume:
|
|
314
|
-
- /ftp
|
|
315
|
-
- /srv
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
### volumes\_from
|
|
319
|
-
|
|
320
|
-
Mount volumes managed by other containers.
|
|
321
|
-
|
|
322
|
-
Examples:
|
|
323
|
-
|
|
324
|
-
```yaml
|
|
325
|
-
volumes_from: repos
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
```yaml
|
|
329
|
-
volumes_from:
|
|
330
|
-
- repos
|
|
331
|
-
- logging
|
|
332
|
-
- rvm
|
|
142
|
+
platforms:
|
|
143
|
+
- name: ubuntu-24.04 # image: ubuntu:24.04, platform: ubuntu
|
|
144
|
+
- name: almalinux-9 # image: almalinux:9, platform: almalinux
|
|
145
|
+
- name: fedora-latest # image: fedora:latest, platform: fedora
|
|
333
146
|
```
|
|
334
147
|
|
|
335
|
-
|
|
148
|
+
`centos` is special-cased, because its images are tagged `centos7` rather than
|
|
149
|
+
`centos:7`.
|
|
336
150
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
Examples:
|
|
151
|
+
Set `image` and `platform` explicitly when the image name does not match the
|
|
152
|
+
distribution, which is common for vendor or mirror images:
|
|
341
153
|
|
|
342
154
|
```yaml
|
|
343
|
-
|
|
155
|
+
platforms:
|
|
156
|
+
- name: centos-stream-9
|
|
157
|
+
driver:
|
|
158
|
+
image: dokken/centos-stream-9
|
|
159
|
+
platform: centosstream
|
|
344
160
|
```
|
|
345
161
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
- type=volume,source=my-volume,destination=/path/in/container
|
|
349
|
-
- type=tmpfs,tmpfs-size=512M,destination=/path/to/tmpdir
|
|
350
|
-
```
|
|
162
|
+
`platform` selects how the Dockerfile bootstraps the container, so it must be
|
|
163
|
+
one the driver recognises:
|
|
351
164
|
|
|
352
|
-
|
|
165
|
+
| `platform` | Notes |
|
|
166
|
+
| --- | --- |
|
|
167
|
+
| `debian`, `ubuntu` | Also honours [`disable_upstart`](#provisioning-the-image). |
|
|
168
|
+
| `rhel`, `centos`, `oraclelinux` | Shared RHEL package set. |
|
|
169
|
+
| `almalinux`, `rockylinux`, `centosstream` | RHEL rebuilds, each with its own package set. |
|
|
170
|
+
| `amazonlinux` | Adds `--allowerasing` to `dnf install`. |
|
|
171
|
+
| `fedora` | |
|
|
172
|
+
| `arch` | |
|
|
173
|
+
| `gentoo`, `gentoo-paludis` | |
|
|
174
|
+
| `opensuse`, `opensuse/leap`, `opensuse/tumbleweed`, `sles` | |
|
|
175
|
+
| `photon` | |
|
|
176
|
+
| `windows` | Uses Windows containers; see [Windows containers](#windows-containers). |
|
|
353
177
|
|
|
354
|
-
|
|
178
|
+
Anything else raises `Unknown platform '<name>'`. If your distribution is not
|
|
179
|
+
listed, supply your own [`dockerfile`](#images-and-building) instead.
|
|
355
180
|
|
|
356
|
-
|
|
181
|
+
## Driver configuration
|
|
357
182
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
```
|
|
183
|
+
Everything in this section goes under `driver:` — either at the top level, or
|
|
184
|
+
per-platform and per-suite:
|
|
361
185
|
|
|
362
186
|
```yaml
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
### dns
|
|
369
|
-
|
|
370
|
-
Adjusts `resolv.conf` to use the dns servers specified. Otherwise use
|
|
371
|
-
Dockers defaults.
|
|
372
|
-
|
|
373
|
-
Examples:
|
|
187
|
+
driver:
|
|
188
|
+
name: docker
|
|
189
|
+
privileged: true # applies everywhere
|
|
374
190
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
191
|
+
platforms:
|
|
192
|
+
- name: ubuntu-24.04
|
|
193
|
+
driver:
|
|
194
|
+
forward: # applies to this platform only
|
|
195
|
+
- 8080:80
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Images and building
|
|
199
|
+
|
|
200
|
+
| Option | Default | Description |
|
|
201
|
+
| --- | --- | --- |
|
|
202
|
+
| `image` | derived from the platform name | Base image for the container. |
|
|
203
|
+
| `platform` | derived from the platform name | Distribution family, used to bootstrap the image. See [above](#choosing-an-image-and-platform). |
|
|
204
|
+
| `dockerfile` | *(none)* | Path to your own Dockerfile, used instead of the generated one. Rendered as [ERB](#using-a-custom-dockerfile). |
|
|
205
|
+
| `build_context` | `true` locally, `false` for a remote daemon | Send the working directory to the daemon as build context. Required for `ADD` and `COPY`; slow against a remote daemon. |
|
|
206
|
+
| `build_options` | *(none)* | Extra flags for `docker build`, as a string or a map. |
|
|
207
|
+
| `build_tempdir` | working directory | Where the generated Dockerfile is written, relative to `build_context`. |
|
|
208
|
+
| `use_cache` | `true` | Use Docker's build cache. `false` adds `--no-cache`. |
|
|
209
|
+
| `remove_images` | `false` | Remove the built image on `kitchen destroy`. |
|
|
210
|
+
| `docker_platform` | *(none)* | Target architecture, passed as `--platform` to both build and run — e.g. `linux/arm64`. |
|
|
211
|
+
|
|
212
|
+
### Provisioning the image
|
|
213
|
+
|
|
214
|
+
| Option | Default | Description |
|
|
215
|
+
| --- | --- | --- |
|
|
216
|
+
| `provision_command` | *(none)* | Command, or list of commands, to run while building the image. Each becomes a `RUN` line. |
|
|
217
|
+
| `disable_upstart` | `true` | Neutralise upstart on Debian and Ubuntu images that ship a broken copy. Ignored on other platforms. |
|
|
218
|
+
| `username` | `kitchen` on Linux, unset on Windows | Account created in the image and used for the connection. |
|
|
219
|
+
| `private_key` | `.kitchen/docker_id_rsa` | SSH key used to reach the container. Generated on first use if absent. |
|
|
220
|
+
| `public_key` | `.kitchen/docker_id_rsa.pub` | Matching public key, authorised in the image. |
|
|
221
|
+
|
|
222
|
+
### Running the container
|
|
223
|
+
|
|
224
|
+
| Option | Default | Description |
|
|
225
|
+
| --- | --- | --- |
|
|
226
|
+
| `run_command` | `sshd -D …` on Linux, `ping -t localhost` on Windows | Process run as PID 1. It must stay in the foreground, or the container will exit immediately. |
|
|
227
|
+
| `run_options` | *(none)* | Extra flags for `docker run`, as a string or a map. |
|
|
228
|
+
| `instance_name` | generated, unique | `--name` for the container. Set it to give other containers a stable name to `link` to. |
|
|
229
|
+
| `hostname` | Docker's default | Container hostname. |
|
|
230
|
+
| `memory` | Docker's default | Memory limit in bytes. |
|
|
231
|
+
| `cpu` | Docker's default | CPU shares (relative weight). |
|
|
232
|
+
| `gpus` | *(none)* | Passed as `--gpus`. Requires a GPU-enabled Docker installation. |
|
|
233
|
+
| `isolation` | Docker's default | Isolation technology — `hyperv` or `process` for Windows containers. |
|
|
234
|
+
| `interactive` | `false` | Pass `-i`, keeping stdin open. |
|
|
235
|
+
| `tty` | `false` | Pass `-t`, allocating a pseudo-TTY. |
|
|
236
|
+
| `env_variables` | *(none)* | Environment variables set in the container, as a map. |
|
|
237
|
+
| `wait_for_transport` | `true` | Wait for the transport to answer before converging. Set `false` for containers that do not stay up. |
|
|
238
|
+
| `detach` | `false` | Run provisioner commands with `docker exec -d`, returning immediately instead of waiting for them. The container itself is always started detached, regardless of this setting, and `kitchen login` ignores it so the shell stays usable. |
|
|
239
|
+
|
|
240
|
+
### Networking
|
|
241
|
+
|
|
242
|
+
| Option | Default | Description |
|
|
243
|
+
| --- | --- | --- |
|
|
244
|
+
| `forward` | *(none)* | Ports to publish, as `container` or `host:container`. Docker picks the host port if you omit it. |
|
|
245
|
+
| `publish_all` | `false` | Publish every exposed port to a random host port (`-P`). |
|
|
246
|
+
| `dns` | Docker's default | DNS servers for the container. |
|
|
247
|
+
| `add_host` | *(none)* | Extra `/etc/hosts` entries, as a map of hostname to IP. |
|
|
248
|
+
| `links` | *(none)* | Other containers to link, as `name:alias`. |
|
|
249
|
+
| `use_internal_docker_network` | `false` | Connect over the container's own IP on port 22 instead of a forwarded host port. Needed when Test Kitchen itself runs inside a container. |
|
|
250
|
+
|
|
251
|
+
### Storage
|
|
252
|
+
|
|
253
|
+
| Option | Default | Description |
|
|
254
|
+
| --- | --- | --- |
|
|
255
|
+
| `volume` | *(none)* | Volumes to add, in `docker run -v` syntax. |
|
|
256
|
+
| `volumes_from` | *(none)* | Containers whose volumes to mount. |
|
|
257
|
+
| `mount` | *(none)* | Mounts in `--mount` syntax. Requires Docker 17.05 or newer. |
|
|
258
|
+
| `tmpfs` | *(none)* | tmpfs mounts, e.g. `/tmp` or `/tmp:exec`. |
|
|
259
|
+
| `devices` | *(none)* | Host devices to share. Must be absolute paths. |
|
|
260
|
+
|
|
261
|
+
Each of these accepts a single value or a list.
|
|
262
|
+
|
|
263
|
+
### Security and privileges
|
|
264
|
+
|
|
265
|
+
| Option | Default | Description |
|
|
266
|
+
| --- | --- | --- |
|
|
267
|
+
| `privileged` | `false` | Run the container privileged. Needed for systemd, Docker-in-Docker, and some kernel-level tests. |
|
|
268
|
+
| `cap_add` | *(none)* | Capabilities to add, e.g. `SYS_PTRACE`. |
|
|
269
|
+
| `cap_drop` | *(none)* | Capabilities to drop. |
|
|
270
|
+
| `security_opt` | *(none)* | SELinux or AppArmor profiles — finer-grained than `privileged`. |
|
|
271
|
+
|
|
272
|
+
### Proxies
|
|
273
|
+
|
|
274
|
+
| Option | Default | Description |
|
|
275
|
+
| --- | --- | --- |
|
|
276
|
+
| `http_proxy` | *(none)* | Set as `http_proxy` and `HTTP_PROXY`, both in the image and in the running container. |
|
|
277
|
+
| `https_proxy` | *(none)* | Set as `https_proxy` and `HTTPS_PROXY`, in the image and the container. |
|
|
278
|
+
| `no_proxy` | *(none)* | Set as `no_proxy` and `NO_PROXY` **in the image only**, for use during the build. |
|
|
279
|
+
|
|
280
|
+
### Connecting to the Docker daemon
|
|
281
|
+
|
|
282
|
+
| Option | Default | Description |
|
|
283
|
+
| --- | --- | --- |
|
|
284
|
+
| `binary` | `docker` | Docker CLI to invoke — e.g. `docker.io`, or an absolute path. |
|
|
285
|
+
| `socket` | `$DOCKER_HOST`, else `unix:///var/run/docker.sock` (`npipe:////./pipe/docker_engine` on Windows) | Daemon to talk to. A `tcp://` value also supplies the host used for SSH to the container. |
|
|
286
|
+
| `use_sudo` | `false` | Run every `docker` command through `sudo`. |
|
|
287
|
+
| `tls` | `false` | Use TLS when connecting. |
|
|
288
|
+
| `tls_verify` | `false` | Verify the daemon's certificate. |
|
|
289
|
+
| `tls_cacert` | *(none)* | Path to the CA certificate. |
|
|
290
|
+
| `tls_cert` | *(none)* | Path to the client certificate. |
|
|
291
|
+
| `tls_key` | *(none)* | Path to the client key. |
|
|
292
|
+
|
|
293
|
+
## Transport configuration
|
|
294
|
+
|
|
295
|
+
The `docker` transport runs commands with `docker exec` rather than over SSH or
|
|
296
|
+
WinRM. It is the recommended pairing with this driver, and is required for
|
|
297
|
+
Windows containers, which have no WinRM service:
|
|
378
298
|
|
|
379
299
|
```yaml
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
- 8.8.4.4
|
|
300
|
+
transport:
|
|
301
|
+
name: docker
|
|
383
302
|
```
|
|
384
303
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
Sets an http proxy for the suite container using the `http_proxy` environment variable.
|
|
388
|
-
|
|
389
|
-
Examples:
|
|
304
|
+
These options go under `transport:`, not `driver:`.
|
|
390
305
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
306
|
+
| Option | Default | Description |
|
|
307
|
+
| --- | --- | --- |
|
|
308
|
+
| `binary` | `docker` | Docker CLI to invoke. |
|
|
309
|
+
| `socket` | `$DOCKER_HOST`, else the platform default | Daemon to talk to. |
|
|
310
|
+
| `username` | `kitchen` on Linux, unset on Windows | User that commands run as (`-u`). |
|
|
311
|
+
| `working_dir` | *(none)* | Working directory inside the container (`-w`). |
|
|
312
|
+
| `temp_dir` | `/tmp`, or `$env:TEMP` on Windows | Directory used to stage uploaded files. |
|
|
313
|
+
| `env_variables` | *(none)* | Environment variables for each command. |
|
|
314
|
+
| `privileged` | `false` | Run commands with `--privileged`. |
|
|
315
|
+
| `interactive` | `false` | Pass `-i`. |
|
|
316
|
+
| `tty` | `false` | Pass `-t`. |
|
|
317
|
+
| `tls`, `tls_verify`, `tls_cacert`, `tls_cert`, `tls_key` | as for the driver | TLS settings for the daemon connection. |
|
|
394
318
|
|
|
395
|
-
|
|
319
|
+
The driver and transport each read their own copy of `binary`, `socket`,
|
|
320
|
+
`username`, and the TLS settings. If you point one at a non-default daemon,
|
|
321
|
+
point the other at it too.
|
|
396
322
|
|
|
397
|
-
|
|
323
|
+
## Logging into a container
|
|
398
324
|
|
|
399
|
-
|
|
325
|
+
`kitchen login` opens an interactive shell inside a running container, so you
|
|
326
|
+
do not have to look up the container ID and run `docker exec` yourself:
|
|
400
327
|
|
|
401
|
-
```
|
|
402
|
-
|
|
328
|
+
```sh
|
|
329
|
+
kitchen login default-ubuntu-2404
|
|
403
330
|
```
|
|
404
331
|
|
|
405
|
-
|
|
332
|
+
On Linux platforms this starts `/bin/bash --login -i`; on Windows platforms it
|
|
333
|
+
starts `powershell`. The transport's `username`, `working_dir`,
|
|
334
|
+
`env_variables`, and `privileged` settings are honoured, so the shell matches
|
|
335
|
+
the environment the provisioner ran in.
|
|
406
336
|
|
|
407
|
-
|
|
408
|
-
the host (public) port in the mappings, if not, Docker chooses for you.
|
|
337
|
+
## Examples
|
|
409
338
|
|
|
410
|
-
|
|
339
|
+
### Testing a systemd service
|
|
411
340
|
|
|
412
|
-
|
|
413
|
-
forward: 80
|
|
414
|
-
```
|
|
341
|
+
systemd needs to run as PID 1 with enough privileges to manage cgroups:
|
|
415
342
|
|
|
416
343
|
```yaml
|
|
417
|
-
|
|
418
|
-
-
|
|
419
|
-
|
|
344
|
+
platforms:
|
|
345
|
+
- name: almalinux-9
|
|
346
|
+
driver:
|
|
347
|
+
run_command: /usr/sbin/init
|
|
348
|
+
privileged: true
|
|
349
|
+
volume: /sys/fs/cgroup:/sys/fs/cgroup:ro
|
|
420
350
|
```
|
|
421
351
|
|
|
422
|
-
|
|
352
|
+
Because `run_command` is no longer `sshd`, pair this with `transport: docker`
|
|
353
|
+
so Test Kitchen does not try to connect over SSH.
|
|
423
354
|
|
|
424
|
-
|
|
355
|
+
### Using a custom Dockerfile
|
|
425
356
|
|
|
426
|
-
|
|
357
|
+
Point `dockerfile` at your own file to bypass the generated one entirely:
|
|
427
358
|
|
|
428
359
|
```yaml
|
|
429
|
-
|
|
360
|
+
platforms:
|
|
361
|
+
- name: custom
|
|
362
|
+
driver:
|
|
363
|
+
dockerfile: test/Dockerfile
|
|
364
|
+
username: dockerfile
|
|
365
|
+
password: dockerfile
|
|
430
366
|
```
|
|
431
367
|
|
|
432
|
-
|
|
368
|
+
The file is rendered as an **ERB template**, and every driver configuration key
|
|
369
|
+
is available as an instance variable of the same name — `@username`, `@image`,
|
|
370
|
+
`@public_key`, and so on, including keys you invent yourself (`@password`
|
|
371
|
+
above). That is how a custom Dockerfile authorises the key Test Kitchen will
|
|
372
|
+
connect with:
|
|
433
373
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
privileged: true
|
|
374
|
+
```erb
|
|
375
|
+
FROM almalinux:latest
|
|
376
|
+
RUN dnf install -y sudo openssh-server openssh-clients which curl
|
|
377
|
+
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
|
|
378
|
+
RUN useradd -d /home/<%= @username %> -m -s /bin/bash <%= @username %>
|
|
379
|
+
RUN echo '<%= @username %> ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
380
|
+
RUN mkdir -p /home/<%= @username %>/.ssh && chmod 0700 /home/<%= @username %>/.ssh
|
|
381
|
+
RUN echo '<%= IO.read(@public_key).strip %>' >> /home/<%= @username %>/.ssh/authorized_keys
|
|
443
382
|
```
|
|
444
383
|
|
|
445
|
-
|
|
384
|
+
A working copy lives in [`test/Dockerfile`](test/Dockerfile). Your Dockerfile
|
|
385
|
+
is responsible for the SSH server and the `authorized_keys` entry — the driver
|
|
386
|
+
adds nothing to it.
|
|
446
387
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
Examples:
|
|
388
|
+
### Building for another architecture
|
|
450
389
|
|
|
451
390
|
```yaml
|
|
452
|
-
|
|
453
|
-
-
|
|
454
|
-
|
|
391
|
+
platforms:
|
|
392
|
+
- name: ubuntu-24.04
|
|
393
|
+
driver:
|
|
394
|
+
docker_platform: linux/arm64
|
|
455
395
|
```
|
|
456
396
|
|
|
457
|
-
|
|
397
|
+
This requires emulation — install QEMU binfmt handlers (`docker run --privileged
|
|
398
|
+
--rm tonistiigi/binfmt --install all`) or use a Buildx builder that can reach a
|
|
399
|
+
native node.
|
|
458
400
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
Examples:
|
|
401
|
+
### Using a remote daemon over TLS
|
|
462
402
|
|
|
463
403
|
```yaml
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
profiles to grant access to specific resources.
|
|
473
|
-
|
|
474
|
-
Examples:
|
|
404
|
+
driver:
|
|
405
|
+
name: docker
|
|
406
|
+
socket: tcp://docker.example.com:2376
|
|
407
|
+
tls: true
|
|
408
|
+
tls_verify: true
|
|
409
|
+
tls_cacert: ~/.docker/ca.pem
|
|
410
|
+
tls_cert: ~/.docker/cert.pem
|
|
411
|
+
tls_key: ~/.docker/key.pem
|
|
475
412
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
413
|
+
transport:
|
|
414
|
+
name: docker
|
|
415
|
+
socket: tcp://docker.example.com:2376
|
|
416
|
+
tls: true
|
|
417
|
+
tls_verify: true
|
|
418
|
+
tls_cacert: ~/.docker/ca.pem
|
|
419
|
+
tls_cert: ~/.docker/cert.pem
|
|
420
|
+
tls_key: ~/.docker/key.pem
|
|
479
421
|
```
|
|
480
422
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
423
|
+
`build_context` defaults to `false` against a remote daemon, since sending the
|
|
424
|
+
whole working directory over the network is slow. Set it to `true` if your
|
|
425
|
+
Dockerfile uses `ADD` or `COPY`.
|
|
484
426
|
|
|
485
|
-
|
|
427
|
+
### Windows containers
|
|
486
428
|
|
|
487
429
|
```yaml
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
### instance\_name
|
|
492
|
-
|
|
493
|
-
Set the name of container to link to other container(s).
|
|
430
|
+
driver:
|
|
431
|
+
name: docker
|
|
494
432
|
|
|
495
|
-
|
|
433
|
+
transport:
|
|
434
|
+
name: docker
|
|
435
|
+
socket: tcp://localhost:2375
|
|
496
436
|
|
|
497
|
-
|
|
498
|
-
|
|
437
|
+
platforms:
|
|
438
|
+
- name: windows-2022
|
|
439
|
+
driver:
|
|
440
|
+
image: mcr.microsoft.com/windows/servercore:ltsc2022
|
|
441
|
+
platform: windows
|
|
442
|
+
isolation: hyperv
|
|
499
443
|
```
|
|
500
444
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
445
|
+
Windows containers have no WinRM service, so `transport: docker` is required
|
|
446
|
+
rather than optional. If you use the InSpec verifier on Windows, the named-pipe
|
|
447
|
+
socket will not work — the daemon must listen on TCP. Add `hosts` to
|
|
448
|
+
`C:\ProgramData\docker\config\daemon.json`:
|
|
504
449
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
```yaml
|
|
512
|
-
links:
|
|
513
|
-
- db:db
|
|
514
|
-
- kvs:kvs
|
|
450
|
+
```json
|
|
451
|
+
{
|
|
452
|
+
"hosts": ["tcp://0.0.0.0:2375"]
|
|
453
|
+
}
|
|
515
454
|
```
|
|
516
455
|
|
|
517
|
-
###
|
|
518
|
-
|
|
519
|
-
Publish all exposed ports to the host interfaces.
|
|
520
|
-
This option used to communicate between some containers.
|
|
521
|
-
|
|
522
|
-
The default value is `false`.
|
|
523
|
-
|
|
524
|
-
Examples:
|
|
456
|
+
### Building behind a proxy
|
|
525
457
|
|
|
526
458
|
```yaml
|
|
527
|
-
|
|
459
|
+
driver:
|
|
460
|
+
name: docker
|
|
461
|
+
http_proxy: http://proxy.example.com:8080
|
|
462
|
+
https_proxy: http://proxy.example.com:8080
|
|
463
|
+
no_proxy: localhost,127.0.0.1,.internal.example.com
|
|
528
464
|
```
|
|
529
465
|
|
|
530
|
-
###
|
|
466
|
+
### Linking containers together
|
|
531
467
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
Examples:
|
|
468
|
+
Give the container a stable name, then link to it from another suite:
|
|
535
469
|
|
|
536
470
|
```yaml
|
|
537
|
-
|
|
538
|
-
|
|
471
|
+
suites:
|
|
472
|
+
- name: database
|
|
473
|
+
driver:
|
|
474
|
+
instance_name: db
|
|
539
475
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
476
|
+
- name: web
|
|
477
|
+
driver:
|
|
478
|
+
links:
|
|
479
|
+
- db:db
|
|
544
480
|
```
|
|
545
481
|
|
|
546
|
-
###
|
|
547
|
-
|
|
548
|
-
Transfer the cookbook directory (cwd) as build context. This is required for
|
|
549
|
-
Dockerfile commands like ADD and COPY. When using a remote Docker server, the
|
|
550
|
-
whole directory has to be copied, which can be slow.
|
|
482
|
+
### Running Test Kitchen inside a container
|
|
551
483
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
Examples:
|
|
484
|
+
When Test Kitchen itself runs in a container, forwarded host ports are not
|
|
485
|
+
reachable. Connect over the Docker network instead:
|
|
555
486
|
|
|
556
487
|
```yaml
|
|
557
|
-
|
|
488
|
+
driver:
|
|
489
|
+
name: docker
|
|
490
|
+
use_internal_docker_network: true
|
|
558
491
|
```
|
|
559
492
|
|
|
560
|
-
###
|
|
561
|
-
|
|
562
|
-
Extra command-line options to pass to `docker build` when creating the image.
|
|
493
|
+
### Passing flags the driver has no option for
|
|
563
494
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
```yaml
|
|
567
|
-
build_options: --rm=false
|
|
568
|
-
```
|
|
495
|
+
`build_options` and `run_options` are escape hatches, accepting either a raw
|
|
496
|
+
string or a map that is expanded into flags:
|
|
569
497
|
|
|
570
498
|
```yaml
|
|
499
|
+
driver:
|
|
571
500
|
build_options:
|
|
572
501
|
rm: false
|
|
573
|
-
build-arg:
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
### run_options
|
|
577
|
-
|
|
578
|
-
Extra command-line options to pass to `docker run` when starting the container.
|
|
579
|
-
|
|
580
|
-
Examples:
|
|
581
|
-
|
|
582
|
-
```yaml
|
|
502
|
+
build-arg: VERSION=1.2.3
|
|
583
503
|
run_options: --ip=1.2.3.4
|
|
584
504
|
```
|
|
585
505
|
|
|
586
|
-
|
|
587
|
-
run_options:
|
|
588
|
-
tmpfs:
|
|
589
|
-
- /run/lock
|
|
590
|
-
- /tmp
|
|
591
|
-
net: br3
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
### build_tempdir
|
|
595
|
-
|
|
596
|
-
Relative (to `build_context`) temporary directory path for built Dockerfile.
|
|
506
|
+
## Using with Chef
|
|
597
507
|
|
|
598
|
-
|
|
508
|
+
This driver is not tied to Cinc. It builds images and runs containers; it does
|
|
509
|
+
not install either distribution — that is the provisioner's job. If you use
|
|
510
|
+
[Chef Workstation][chef_workstation] rather than
|
|
511
|
+
[Cinc Workstation][cinc_workstation], use `chef_infra` and `inspec`:
|
|
599
512
|
|
|
600
513
|
```yaml
|
|
601
|
-
|
|
602
|
-
|
|
514
|
+
provisioner:
|
|
515
|
+
name: chef_infra
|
|
603
516
|
|
|
604
|
-
|
|
517
|
+
verifier:
|
|
518
|
+
name: inspec
|
|
519
|
+
```
|
|
605
520
|
|
|
606
|
-
|
|
607
|
-
need to set this to true. When set to true uses port 22 as the SSH port and
|
|
608
|
-
the IP of the container that chef is going to run in as the hostname so that
|
|
609
|
-
you can connect to it over SSH from within another Docker container.
|
|
521
|
+
No driver configuration changes are needed.
|
|
610
522
|
|
|
611
|
-
|
|
523
|
+
## Troubleshooting
|
|
612
524
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
525
|
+
**The container exits immediately.** `run_command` must stay in the
|
|
526
|
+
foreground. A command that forks and returns leaves the container with nothing
|
|
527
|
+
running, and Docker stops it.
|
|
616
528
|
|
|
617
|
-
|
|
529
|
+
**`Unknown platform '<name>'`.** The `platform` value is not one the driver can
|
|
530
|
+
bootstrap. Set it to a supported family, or supply your own
|
|
531
|
+
[`dockerfile`](#using-a-custom-dockerfile).
|
|
618
532
|
|
|
619
|
-
|
|
533
|
+
**`ADD` or `COPY` cannot find a file.** Set `build_context: true`. It defaults
|
|
534
|
+
to `false` against a remote daemon.
|
|
620
535
|
|
|
621
|
-
|
|
536
|
+
**Permission denied talking to the daemon.** Either add your user to the
|
|
537
|
+
`docker` group, or set `use_sudo: true`.
|
|
622
538
|
|
|
623
|
-
|
|
624
|
-
docker_platform: linux/arm64
|
|
625
|
-
```
|
|
539
|
+
**Anything else.** Run with `-l debug`:
|
|
626
540
|
|
|
627
|
-
```
|
|
628
|
-
|
|
541
|
+
```sh
|
|
542
|
+
kitchen converge default-ubuntu-2404 -l debug
|
|
629
543
|
```
|
|
630
544
|
|
|
631
|
-
|
|
545
|
+
The debug log contains the generated Dockerfile and the exact `docker build`
|
|
546
|
+
and `docker run` command lines, which is usually enough to see what went wrong.
|
|
632
547
|
|
|
633
|
-
|
|
634
|
-
* Report issues/questions/feature requests on [GitHub Issues][issues]
|
|
548
|
+
## Contributing
|
|
635
549
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
example:
|
|
550
|
+
Bug reports and pull requests are welcome on [GitHub][repo]; please report
|
|
551
|
+
issues on [GitHub Issues][issues].
|
|
639
552
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
643
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
644
|
-
5. Create new Pull Request
|
|
553
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, how to run the
|
|
554
|
+
unit and integration tests, and the release process.
|
|
645
555
|
|
|
646
556
|
## License
|
|
647
557
|
|
|
648
|
-
```text
|
|
649
558
|
Copyright 2013-2016, [Sean Porter](https://github.com/portertech)
|
|
650
559
|
Copyright 2015-2016, [Noah Kantrowitz](https://github.com/coderanger)
|
|
651
560
|
|
|
652
|
-
Licensed under the Apache License, Version 2.0
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
```
|
|
664
|
-
|
|
665
|
-
[issues]: https://github.com/test-kitchen/kitchen-docker/issues
|
|
666
|
-
[repo]: https://github.com/test-kitchen/kitchen-docker
|
|
667
|
-
[docker_installation]: https://docs.docker.com/installation/#installation
|
|
668
|
-
[docker_index]: https://index.docker.io/
|
|
669
|
-
[test_kitchen_docs]: https://kitchen.ci/docs/getting-started/introduction/
|
|
670
|
-
[chef_omnibus_dl]: https://downloads.chef.io/chef-client/
|
|
671
|
-
[cpu_shares]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html
|
|
672
|
-
[memory_limit]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-memory.html
|
|
561
|
+
Licensed under the Apache License, Version 2.0. You may obtain a copy of the
|
|
562
|
+
License at <https://www.apache.org/licenses/LICENSE-2.0>. See
|
|
563
|
+
[LICENSE](LICENSE) for the full text.
|
|
564
|
+
|
|
565
|
+
[issues]: https://github.com/test-kitchen/kitchen-docker/issues
|
|
566
|
+
[repo]: https://github.com/test-kitchen/kitchen-docker
|
|
567
|
+
[dokken]: https://github.com/test-kitchen/kitchen-dokken
|
|
568
|
+
[docker_installation]: https://docs.docker.com/engine/install/
|
|
569
|
+
[test_kitchen_docs]: https://kitchen.ci/docs/getting-started/introduction/
|
|
570
|
+
[cinc_workstation]: https://cinc.sh/start/workstation/
|
|
571
|
+
[chef_workstation]: https://www.chef.io/downloads/tools/workstation
|