Docker Pentesting
Investigation
Find Docker Binary
find / -name "docker" 2>/dev/nullBasic Commands
# Get comprehensive information
docker info
# List images
docker images
docker image ls
# The history of an image
docker image history <image-name>
# List containers running
docker container ls
# or
docker ps
# List all containers
docker container ls -a
# or
docker ps -a
# List secrets
docker secret ls
# Check configuration of container
docker inspect --format='{{json .Config}}' <container_id_or_name>
# Get a port which is used by the container
docker port <container_id_or_name>
# Scan vulnerabilies (CVEs)
docker scan cves <image>
docker scan cves alpine
# View the SBOM (Software Bill of Materials) for an image
# We can investigate vulnerabilities from the list of packages.
docker sbom alpine:latest
# Json format
docker sbom alpine:latest --format syft-json
# Spawn the shell in the container
docker exec -it <container_id> /bin/bash
# Kill the running docker container
docker kill <container_id>Check if Containers Running
Basic Operations
Run a New Container
Start a Container which is stopped
Run Commands in a Container
Stop a Container
Remove a Container
Build a Container Image
Scan a Container Image
Pull a Docker Image
Remove a Docker Image
Publish a Docker Image
Last updated