Refactors docker_image resource (#2518)

Signed-off-by: kagarmoe <kgarmoe@chef.io>
This commit is contained in:
Kimberly Garmoe 2018-02-02 05:13:04 -08:00 committed by Adam Leff
parent 288e9f2607
commit 73f2eebea5

View file

@ -19,6 +19,10 @@ A `docker_image` resource block declares the image:
its('tag') { should eq 'latest' }
end
<br>
## Resource Parameter Examples
The resource allows you to pass in an image id:
describe docker_image(id: alpine_id) do
@ -39,9 +43,31 @@ You can also pass in repository and tag as separate values
<br>
## Examples
## Property Examples
The following examples show how to use this InSpec `docker_image` resource.
### id
The `id` property returns the full image id:
its('id') { should eq 'sha256:4a415e3663882fbc554ee830889c68a33b3585503892cc718a4698e91ef2a526' }
### image
The `image` property tests the value of the image. It is a combination of `repository/tag`:
its('image') { should eq 'alpine:latest' }
### repo
The `repo` property tests the value of the repository name:
its('repo') { should eq 'alpine' }
### tag
The `tag` property tests the value of image tag:
its('tag') { should eq 'latest' }
### Test a docker image
@ -65,26 +91,3 @@ The `exist` matcher tests if the image is available on the node:
it { should exist }
### id
The `id` matcher returns the full image id:
its('id') { should eq 'sha256:4a415e3663882fbc554ee830889c68a33b3585503892cc718a4698e91ef2a526' }
### image
The `image` matcher tests the value of the image. It is a combination of `repository/tag`:
its('image') { should eq 'alpine:latest' }
### repo
The `repo` matcher tests the value of the repository name:
its('repo') { should eq 'alpine' }
### tag
The `tag` matcher tests the value of image tag:
its('tag') { should eq 'latest' }