Sha256: 56782d43923530e35c2a19c00cd77b3c2a8381968667488a3cb894f99455cd0f
Contents?: true
Size: 1.98 KB
Versions: 2
Compression:
Stored size: 1.98 KB
Contents
--- title: About the docker_image Resource platform: linux --- # docker_image Use the `docker_image` InSpec audit resource to verify a docker image. <br> ## Syntax A `docker_image` resource block declares the image: describe docker_image('alpine:latest') do it { should exist } its('id') { should eq 'sha256:4a415e...a526' } its('repo') { should eq 'alpine' } 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 ... end If the tag is missing for an image, `latest` is assumed as default: describe docker_image('alpine') do ... end You can also pass in repository and tag as separate values describe docker_image(repo: 'alpine', tag: 'latest') do ... end <br> ## Property Examples ### 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 describe docker_image('alpine:latest') do it { should exist } its('id') { should eq 'sha256:4a415e...a526' } its('image') { should eq 'alpine:latest' } its('repo') { should eq 'alpine' } its('tag') { should eq 'latest' } end <br> ## Matchers For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/). ### exist The `exist` matcher tests if the image is available on the node: it { should exist }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
inspec-2.0.32 | docs/resources/docker_image.md.erb |
inspec-2.0.17 | docs/resources/docker_image.md.erb |