Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Last active July 24, 2017 15:22
Show Gist options
  • Save wheresalice/804e98f55db0f3cf5d4c12df43ecc6e9 to your computer and use it in GitHub Desktop.
Save wheresalice/804e98f55db0f3cf5d4c12df43ecc6e9 to your computer and use it in GitHub Desktop.
Inspec network testing from Docker

Inspec Docker

Network connectivity tester from Docker.

Usage:

  • git clone https://gist.github.com/804e98f55db0f3cf5d4c12df43ecc6e9.git
  • Build the image with docker build -t inspecnc . in order to get an inspec image with netcat added
  • Run the example tests with docker run -it --rm -v $(pwd):/share inspecnc exec example_spec.rb

TODO:

  • Push the docker image somewhere so that you don't have to build it yourself
  • Pull tests from somewhere configurable so that you don't have to have the tests available locally
FROM chef/inspec
RUN apk add --update netcat-openbsd
control "example" do
impact 1.0
title "Example Webserver"
desc "Example server should be available"
describe http('http://www.example.com') do
its('status') { should eq 200 }
end
describe host('www.example.com', port: 80) do
it { should be_reachable }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment