Class: Examine::CLI::Clair
- Inherits:
-
Thor
- Object
- Thor
- Examine::CLI::Clair
- Defined in:
- lib/examine/cli/clair.rb
Overview
Entrypoint into the ‘examine clair` subcommand.
Constant Summary collapse
- DOWNLOAD_PATH =
'https://github.com/arminc/clair-scanner/releases/download/'
- EXECUTABLES =
{ 'x86-darwin' => 'clair-scanner_darwin_386', 'x86-linux' => 'clair-scanner_linux_386', 'x86_64-darwin' => 'clair-scanner_darwin_amd64', 'x86_64-linux' => 'clair-scanner_linux_amd64' }.freeze
Instance Method Summary collapse
Instance Method Details
#scan(image) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/examine/cli/clair.rb', line 36 def scan(image) start system "docker pull #{image}" system scan_command_for(image, ) end |
#start ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/examine/cli/clair.rb', line 19 def start ensure_docker_installed! return if started? spawn clair_db wait_until clair_db_running? spawn clair_local_scan wait_until clair_local_scan_running? wait_until clair_local_scan_api_reachable? end |
#status ⇒ Object
44 45 46 |
# File 'lib/examine/cli/clair.rb', line 44 def status system 'docker ps -a | grep clair' end |
#stop ⇒ Object
49 50 51 52 |
# File 'lib/examine/cli/clair.rb', line 49 def stop system "docker stop $(docker ps | grep -v CONT | grep clair- | awk '{ print $1 }')" system 'docker system prune -f' end |