Giter Club home page Giter Club logo

container-image-scanner-api's Introduction

Container Image Scanner API

A minimalist Go API to scan Docker images for security vulnerabilities and weaknesses

License Docker Image

TL;DR

Requirements:

  • Docker
  • Docker Compose
  • Go 1.12+

Clone this repository

git clone https://github.com/abhisek/container-image-scanner-api && \
  cd container-image-scanner-api

Build the API server

make

Start services

docker-compose up

The API server container mounts current directory for ease in development. You can re-build API server and restart the service: docker-compose restart apisvr without having the need to rebuild the entire API Server image.

Submit scan:

curl -d '{"image": "ubuntu"}' http://localhost:8000/scans

Get scan status

curl http://localhost:8000/scans/:scan_id/status

Get scan report

curl http://localhost:8000/scans/:scan_id

Note: Scan reports are stored in Redis server with expiration set to 15 minutes. To change time window or disable report expiration set the following environment variable

# Disable report expiration in Redis
export REPORT_EXPIRATION_WINDOW=0

# Set report expiration window to 30 minutes
export REPORT_EXPIRATION_WINDOW=1800

Docker in Docker

The application uses docker:dind (Docker in Docker) for pulling image and scanning with external tools (currently only Trivy and Dockle). This model is to ensure we can run this safely in Kubernetes and avoid any dependency or clutter in host system.

Three containers are used to deliver the service:

  1. Docker in Docker (DIND) container
  2. API Server (This app) container
  3. Redis (For data structure persistence)

/var/run is shared between the two containers to allow API Server access to DIND through unix socket in /var/run/docker.sock

Current Architecture

In memory data structure with go-routine based asynchronous tasks. Check service.go for more details.

Redis is used for persistence with 15 minutes expiration for reports

Proposed Architecture

The current version do not use persistence

container-image-scanner-api's People

Contributors

abhisek avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.