concept Docker Bench in category microservice

appears as: Docker Bench
Microservices Security in Action

This is an excerpt from Manning's book Microservices Security in Action.

Docker Bench for Security is a script that checks a Docker deployment for common, well-known best practices as defined by the Center for Internet Security (CIS) in the Docker Community Edition Benchmark document (https://downloads.cisecurity .org). It’s maintained as an open source project in the Git repository: https://github .com/docker/docker-bench-security.

This script can be executed either by itself or as a Docker container. The following command uses the second approach, where we run Docker Bench for Security with the Docker image docker/docker-bench-security. It checks the Docker host configuration, Docker daemon configuration, all the container images available in the host machine, and container runtimes for possible vulnerabilities. Here we’ve truncated the output to show you only the important areas covered by the Docker for Security Bench at a high level:

\> docker run -it --net host --pid host \
--cap-add audit_control -v /var/lib:/var/lib \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc:/etc --label docker_bench_security \
docker/docker-bench-security

# ---------------------------------------------------------------------------
# Docker Bench for Security v1.3.0
#
# Docker, Inc. (c) 2015-
#
# Checks for dozens of common best practices around deploying Docker 
containers in production.
# Inspired by the CIS Docker 1.13 Benchmark.
# ---------------------------------------------------------------------------
[INFO] 1 - Host Configuration
[WARN] 1.1  - Create a separate partition for containers
[INFO] 1.2  - Harden the container host
[PASS] 1.3  - Keep Docker up to date

[INFO] 2 - Docker Daemon Configuration
[WARN] 2.1  - Restrict network traffic between containers
[PASS] 2.2  - Set the logging level
[PASS] 2.3  - Allow Docker to make changes to iptables

[INFO] 3 - Docker Daemon Configuration Files
[INFO] 3.1  - Verify that docker.service file ownership is
set to root:root
[INFO]      * File not found
[INFO] 3.2  - Verify that docker.service file permissions 
are set to 644 or more restrictive
[INFO]      * File not found

[INFO] 4 - Container Images and Build Files
[WARN] 4.1  - Create a user for the container
[WARN]      * Running as root: affectionate_lichterman
[INFO] 4.2  - Use trusted base images for containers

[INFO] 5 - Container Runtime
[WARN] 5.1  - Do not disable AppArmor Profile
[WARN]      * No AppArmorProfile Found: affectionate_lichterman
[WARN] 5.2  - Verify SELinux security options, if applicable

[INFO] 6 - Docker Security Operations
[INFO] 6.1  - Perform regular security audits of your 
host system and containers
[INFO] 6.2  - Monitor Docker containers usage, performance
and metering

Apart from Docker Bench for Security, a few other alternatives can scan Docker images for known vulnerabilities. Clair is one such open source project (https://github.com/quay/clair) backed by CoreOS (and now RedHat). Anchore (https://github.com/anchore/anchore-engine) is another popular open source project for analyzing vulnerabilities in containers.