Hands-On Lab: Docker Security Checks with Docker Bench Security

Prerequisites

  • Docker installed on your system.
  • git installed for cloning repositories.

Hands-On Lab

Setup Docker Bench Security

  • Change to your desired working directory:

    cd /workspaces/ecr_eks_security_masterclass_public/docker-lab
    
  • Clone the Docker Bench Security repository:

    git clone https://github.com/docker/docker-bench-security.git
    
  • Navigate into the cloned repository:

    cd docker-bench-security
    
  • Make the main script executable:

    chmod +x docker-bench-security.sh
    
  • Run the script to analyze your Docker environment:

    sudo ./docker-bench-security.sh
    

Review the output.

Cleanup Docker Bench Security

  • Remove the cloned repository:
    cd ..
    rm -rf docker-bench-security
    

Cleanup the running containers & images.

  • Remove all running and stopped containers.

    docker rm -f $(docker ps -aq)
    
  • Remove all images.

    docker rmi -f $(docker images -aq)
    

Note: Aqua Security's Docker Bench for Security is outdated and is a fork of Docker's Docker Bench for Security. Therefore, we are using the original repository.