Quick validation of an inspected Docker image according to a policy file
100K+
Quick validation of an inspected Docker image according to a policy file
docker inspect expects the image to be stored locally, run docker pull {target_image} if not yet localPipe a target image's Docker-inspected output into container's stdin
$ docker pull ubuntu:18.04
$ docker inspect ubuntu:18.04 | docker run -i bryanlatten/docker-image-policy
docker inspect ubuntu:18.04 | docker run -i bryanlatten/docker-image-policy
Scanning <8672b25e842c4c36f9f75d7edf48844ad32af57cf40596f5f236ed6462f073ba>
Docker Build: 17.03.0-ce
Parent:
Using policy <./default_policy.yaml>
[PASS] labels validated
[PASS] env keys validated
[PASS] volumes not allowed, none defined
[PASS] exposed ports allowed, none detected
[PASS] no exposed ports for range check [1025-65535]
[WARN] 697MB container size, recommend < 500MB
[PASS] no healthcheck specified
[PASS] 8 filesystem layers, maximum: 100
Status [PASS]
docker inspect failingImageTag:v1 | docker run -i bryanlatten/docker-image-policy
Scanning <sha256:4612b98d0345171da30a0318faa9d1b05da7c8cb1440d5f5d2e5f032f49908c0>
Docker Build: 17.03.0-ce
Parent: sha256:905312a465bdd005beb8d6c319f1170e391d9c9f0da8d4da60d7eccc16b56661
Using policy <./default_policy.yaml>
[PASS] 4MB within 1500MB container size limit
[FAIL] disallowed labels present:
- com.swipely.iam-docker.iam-profile
[FAIL] disallowed env keys present:
- IAM_ROLE
[PASS] volumes not allowed, none defined
[FAIL] exposed port(s) required
[PASS] no healthcheck specified
[PASS] 3 filesystem layers, maximum: 100
Status [FAIL]
A YAML file to describe specific policies to validate for the given docker image
Supported rules:
LABEL usage by namelabels:
disallow:
- com.swipely.iam-docker.iam-profile
ENV usage by nameenv_keys:
disallow:
- IAM_ROLE
EXPOSE ports ranges, and/or require to comply to a rangeports:
required: true
range: '8080-99999'
VOLUME usagevolumes:
disallowed: true
size:
# In MB
max: 1500
warning: 1000
healthcheck:
# Causes contention between orchestrator and Docker engine health status
disallowed: true;
layers:
max: 100
warning: 20
npm iinspect output into app
docker inspect {target_image} | node index.jsnpm test in working directorydocker build -t imagepolicy .docker inspect {target_image} | docker run -i imagepolicyContent type
Image
Digest
Size
26.9 MB
Last updated
over 5 years ago
docker pull bryanlatten/docker-image-policy